Skip to content

Commit d7495e4

Browse files
committed
fix: restore old stream conversion
1 parent f70d49f commit d7495e4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/http.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,23 @@ const fromStream = (source) => {
282282
}
283283

284284
if (isWebReadableStream(source)) {
285-
return browserReableStreamToIt(source)
285+
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+
})()
286302
}
287303

288304
throw new TypeError('Body can\'t be converted to AsyncIterable')

0 commit comments

Comments
 (0)