You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
node-fetch overloads body on Request / Response objects by using node native streams as opposed to web standard streams. It also makes assumptions about .stream() method on Blobs to be node streams as opposed to web streams.
Describe the solution you'd like
I would like to propose an alternative which can retain convenience of having node native streams in node without creating a problem for libraries that expect web streams instead of node streams. I would like to propose:
Renaming .body to something else that does not overload standard field e.g. body.toNodeStream() method (Could be whatever other name as long as it's less prone to conflict with current and future fields).
Rename current blob.stream() method on blobs to blob.toNodeStream() method as well.
That would retain convenience of having node streams without introducing conflicts. With that in place web standard compatible fields could be added:
body getter that can wrap this.toNodeStream() into a web ReadableStream.
blob.stream() that would also just wrap this.toNodeStream().
Also it is possible to leave out last two. Third party library could just wrap node-fetch , fetch-blob to bring a desired compatibility.
Describe alternatives you've considered
Forking and replacing node streams with web streams, which would be unfortunate and would lead to fragmentation as opposed to cooperation.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
node-fetch overloads
body
onRequest
/Response
objects by using node native streams as opposed to web standard streams. It also makes assumptions about.stream()
method onBlob
s to be node streams as opposed to web streams.Describe the solution you'd like
I would like to propose an alternative which can retain convenience of having node native streams in node without creating a problem for libraries that expect web streams instead of node streams. I would like to propose:
.body
to something else that does not overload standard field e.g.body.toNodeStream()
method (Could be whatever other name as long as it's less prone to conflict with current and future fields).blob.stream()
method on blobs toblob.toNodeStream()
method as well.That would retain convenience of having node streams without introducing conflicts. With that in place web standard compatible fields could be added:
body
getter that can wrapthis.toNodeStream()
into a webReadableStream
.blob.stream()
that would also just wrapthis.toNodeStream()
.Also it is possible to leave out last two. Third party library could just wrap
node-fetch
,fetch-blob
to bring a desired compatibility.Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: