summaryrefslogtreecommitdiff
path: root/includes/external/addressbook/node_modules/axios/lib/helpers/readBlob.js
blob: 6de748e8e263c24a3b10d818eef33025fe222e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const {asyncIterator} = Symbol;

const readBlob = async function* (blob) {
  if (blob.stream) {
    yield* blob.stream()
  } else if (blob.arrayBuffer) {
    yield await blob.arrayBuffer()
  } else if (blob[asyncIterator]) {
    yield* blob[asyncIterator]();
  } else {
    yield blob;
  }
}

export default readBlob;