Repository navigation
readable.pipe returns stream.Readable #22341
Description
Activity
- addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.streamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
on Aug 15, 2018 Hi! Can you explain what you are asking here? While everything you said is accurate, it’s not clear what you would like to see changed (if anything).
Chaining pipes using this method only makes sense if the target
Writablealso implements theReadableinterface, yes. ForGunzipstreams, or generally Duplex streams, that is the case.If the returned value is not a
Readableinstance, then chaining pipes won’t work, but it’s still a meaningful thing and may be helpful to have (e.g. event listeners can be installed on it).I think changing what
.pipe()returns would be too big of a breaking change, in case that’s what you are suggesting here.I'm only asking to make the documentation a little clearer. I guess I should have checked the code to determine that the
destinationparameter topipeis just the return value (currently not documented). I think that it would be beneficial to document explicitly that chaining pipes only works if the targetWritablealso implements theReadableinterface. In the current documentation, it is confusing to understand why returning aWritablewould support chaining.It would also be helpful to document that Gunzip implements both
ReadableandWritable. That's kind of implied but there is no documentation on the methods of this class or its siblings.Reacted by Anna Henningsen and Tom White- addeddocIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.and removedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Aug 15, 2018 - added a commit that references this issue
on Aug 19, 2018 - added a commit that references this issue
on Sep 3, 2018 - added a commit that references this issue
on Jul 27, 2026
readable.pipe is documented to return
stream.Writable. However, as onlystream.Readablehas apipemethod, it only makes sense to return that to set up chains of piped streams. I also verified that a pipe to aGunzipobject could be used as aReadablestream.