-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chaining pipe for streams - probably stupid question but... #2384
Comments
I’m not sure if that’s what you’re asking, but there is no connection between the writable side of |
Indeed, if you don't do anything with stream2 then no magic happens with pipe Now I still have some hard time to get the pipe behavior, once data are processed then you push on the related stream and then pipe writes on the piped stream, OK Now the use case is: a.pipe(b).etc.pipe(z) bidirectionnal Which I think is used everywhere by node (http.pipe(gzip).pipe(socket)) so it should be easy The way forward from a to z is clear, how do you handle the way backward without piping z to a or using something like a duplex pair? Personnally I would have thought that one way is write/write/write and the other way read/read/read, here we are using both to go only in one direction, or missing something again, probably some link to some code doing the intended behavior would clarify |
This is impossible to do without implementing something like duplex pairs And for me this is clearly a misspecification of the pipe method so I suggest you transfer it back to the bug tracker
And the doc states that writables can be chained via pipes, this is not correct since all pipe streams must be duplex stream and not only writables |
There has been no activity on this issue for 3 years and it may no longer be relevant. It will be closed 1 month after the last non-automated comment. |
There has been no activity on this issue and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment. |
The test code is simply:
The result is:
Then stream1 receives nothing, there are of course different ways to solve this but probably I am missing something obvious because if we have to implement something like
this.push(data)
instream2._write
then I don't see the use of chaining pipes (we can do stream3.write(data))The doc states that we can pipe from a readable and chain writable streams (the result of the pipe here is a duplex stream, the doc does not say how the pipe handles the
write
from the writable to theread
of the readable to send the data forward to the piped stream)The example is always the same using gzip, after some research I did not find any other examples except duplex pairs which looks strange since we can wonder then why we are using Duplex streams
That's why I am asking
The text was updated successfully, but these errors were encountered: