You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
318 B
15 lines
318 B
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;
|
|
|