Thanks for your answers :),
The aggregate module does the job of aggretate 3 readables stream into 1
with the Cat "class", thanks.
The code that you propose Raynos doesn't work for this case, because when
the first readable stream will emit "end", the pipe method will call the
end method of the writable stream.
Which means the writable stream is not more writable since "this.writable"
is set to false when the end method is called. So next time another of the
readable streams will emit "data", two things can happen, the pipe method
call the write method of the writable stream in this case the writable
stream shoud/will throw an error since the end method has been called
before and "this.writable" is false or the data emitted will be ignored
because the writable stream has its "this.writable" set to false. Am I
right or I miss something important in the code?
For the second piece of code, you are completely right, I haven't think
about it but it seems there is no need to do some sort of control on the
different events since the trouble happens when data are emitted when the
method end has already been called, in this case it can't happen. But maybe
it would be nice to have a stream who know exactly how many streams will be
piped and so return false when write is called until all streams are piped
or cache the data emitted until all streams are piped.
Interesting, why this could not be considered as demultiplexer
Tell me more, thank you.
Le lundi 3 septembre 2012 18:19:34 UTC+1, Raynos a écrit :