main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
318 bytes
|
Rev | Line | |
---|
[d565449] | 1 | const {asyncIterator} = Symbol;
|
---|
| 2 |
|
---|
| 3 | const readBlob = async function* (blob) {
|
---|
| 4 | if (blob.stream) {
|
---|
| 5 | yield* blob.stream()
|
---|
| 6 | } else if (blob.arrayBuffer) {
|
---|
| 7 | yield await blob.arrayBuffer()
|
---|
| 8 | } else if (blob[asyncIterator]) {
|
---|
| 9 | yield* blob[asyncIterator]();
|
---|
| 10 | } else {
|
---|
| 11 | yield blob;
|
---|
| 12 | }
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | export default readBlob;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.