Skip to content

Why there is not Body.prototype.getReader API? #1711

Answered by jimmywarting
manooog asked this question in Q&A
Discussion options

You must be logged in to vote

node-fetch was create long before web streams where introduced into NodeJS, and most node api used node:streams anyways which lead to us not simply using it. so we compromised a bit cuz most ppl would just convert it into a node:stream anyway to use it along with node:fs and other things.

Now this have changed. web streams have been introduced into NodeJS, more and more api's accept Uint8Array and async iterators now instead. So a async iterable web stream can be written to the disc without conversion back into a node:stream and then being piped to.

Now we could switch to using web streams, and those who still need node:streams could use streams.Readable.from(iterable)
but that would be a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@manooog
Comment options

Answer selected by manooog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants