Thanks, Floby. I think your suggestion of a balancing multi-output stream 
is a good idea.


On Tuesday, September 10, 2013 12:07:51 AM UTC-7, Floby wrote:
>
> I'd go with a different solution where this is not the transform stream 
> doing the load balancing...
>
> The transform stream transforms. you need another stream to balance.
>
> Source -> transform -> balance -> (dest1, dest2)
>
> You'd need to override the pipe method on your balance stream, which might 
> be easier said than done (right).
> Of course, there may already be a module that does exactly that, that I'm 
> not aware of.
>
> On Monday, 9 September 2013 20:55:48 UTC+2, Tyler Neylon wrote:
>>
>> You can call pipe multiple times on a single readable stream, like this:
>>
>> var reader = createReadableStream();
>> reader.pipe(createWritableStream(1));
>> reader.pipe(createWritableStream(2));
>>
>> which is cool. However, I am implementing a transform stream, and I'd 
>> like to be able to do something like this:
>>
>> var transform = createTransformStream();
>> reader.pipe(transform);
>> transform.multipipe(1, writer1);  // NOT the usual pipe; args explained 
>> below.
>> transform.multipipe(2, writer2);
>>
>> where the transform stream is smart enough to slow down its input if 
>> *either* writer1 or writer2 request to pause (i.e. return false on a call 
>> to write()).
>>
>> The notation multipipe(n, <writer>) is meant to indicate that the two 
>> writers receive different streams, unlike the usual behavior of pipe in the 
>> first example. This is analogous to piping in bash where I have separate 
>> output via both stderr and stdout, like this:
>>
>> $ cat afile | ./somebinary > outfile1 &> outfile2
>>
>> Is there a nice way to support this functionality in the current streams 
>> interface?
>>
>> thanks!
>>
>>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to