nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
105.61k stars 28.65k forks source link

doc: note readable/writeable .toWeb()/.fromWeb() exist in webstreams docs #45381

Open bnb opened 1 year ago

bnb commented 1 year ago

Affected URL(s)

https://nodejs.org/api/webstreams.html

Description of the problem

currently, there's no indication on the webstreams docs that .toWeb() and .fromWeb() exist. Noting that they exist somewhere on the webstreams docs would probably be a good idea. I just watched two very capable engineers spend longer than they should have figure out that these features existed while trying to use fetch and streams because they weren't in the webstreams docs - if they're tripping over this, I very much imagine it will be something that comes up again for others.

nornagon commented 1 year ago

Even better, could this transformation be done automatically? There’s really only one reasonable thing to do when passing a WriteStream to something that expects a WritableStream.

MrJithil commented 1 year ago

We have some docs in https://nodejs.org/api/stream.html#streamwritabletowebstreamwritable

bnb commented 1 year ago

@MrJithil yes, that's the problem. It's only documented in one place, which is notably not the place you'd be looking for context on WebStreams.

bnb commented 1 year ago

going to add the https://github.com/nodejs/node/labels/good%20first%20issue label to this because it's a relatively minor change - about a paragraph or so - and doesn't need any domain specific knowledge. If any collaborators want to remove that because they disagree with me, feel free.

7suyash7 commented 1 year ago

Hey, @bnb, I Just wanted to ask where the details about .toWeb and .fromWeb() will go? I'm assuming they go under Class: ReadableStream, Class: WritableStream and Class: TransformStream each. Also, should it just be a small description like how it is here or will it be good to add some implementation to it? Thanks! (PS: if the above sounds good, please assign this issue to me)

bnb commented 1 year ago

@7suyash7 I'd probably either just at the top under the overview section or as you noted in each of those sections. Either is a valid approach IMO, though PR reviewers might disagree with me. I would recommend just having whatever is implemented as a note that links to the actual API docs for those methods, rather than having code examples. However if you also want to improve those API docs, that's of course welcome as well 😊

7suyash7 commented 1 year ago

@bnb PTAL. Thanks!

jayshreek3 commented 9 months ago

Hey, @bnb! Kindly review this fix #50255 for issue #45381 Thanks!