Why there is not Body.prototype.getReader API? #1711
-
As we can see, Body is sub of Stream,which has getReader API,see below: https://streams.spec.whatwg.org/#ref-for-rs-get-reader%E2%91%A4 So, why node-fetch not implement the same interface? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
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 Now we could switch to using web streams, and those who still need but the opposite is also possible to do using |
Beta Was this translation helpful? Give feedback.
node-fetch
was create long before web streams where introduced into NodeJS, and most node api usednode:streams
anyways which lead to us not simply using it. so we compromised a bit cuz most ppl would just convert it into anode:stream
anyway to use it along withnode: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 usestreams.Readable.from(iterable)
but that would be a…