We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f70d49f commit d7495e4Copy full SHA for d7495e4
src/http.js
@@ -282,7 +282,23 @@ const fromStream = (source) => {
282
}
283
284
if (isWebReadableStream(source)) {
285
- return browserReableStreamToIt(source)
+ const reader = source.getReader()
286
+ return (async function * () {
287
+ try {
288
+ while (true) {
289
+ // Read from the stream
290
+ const { done, value } = await reader.read()
291
+ // Exit if we're done
292
+ if (done) return
293
+ // Else yield the chunk
294
+ if (value) {
295
+ yield value
296
+ }
297
298
+ } finally {
299
+ reader.releaseLock()
300
301
+ })()
302
303
304
throw new TypeError('Body can\'t be converted to AsyncIterable')
0 commit comments