I just came up against this trying to proxy a stream. This seems to work 
for me:
    
    proxy.on 'pipe', (pipeSrc) ->
        src = pipeSrc
    proxy.pipe = (pipeDest) ->
        unless proxied
            throw new Error 'proxied stream has not been enabled'
        src.removeAllListeners()
        src.pipe(proxied).pipe(pipeDest)



On Tuesday, September 18, 2012 8:09:17 PM UTC-7, Mikeal Rogers wrote:
>
> We should rethink a lot of these unpipe() questions for read() streams, 
> and possibly add an explicit API.
>
> Isaacs, what do you think?
>
> -Mikeal
>
> On Sep 18, 2012, at September 18, 20128:04 PM, Yi Tan 
> <[email protected]<javascript:>> 
> wrote:
>
> a few thoughts:
>
> 1. add an unique id to each stream
> 2. add an destination id to each piper stream, which is a foreign key to 
> the id of pipee 
> 3. introduce a static stream piping class, to do all the conduction jobs
>
> Regards,
>
> ty
>
>
> 2012/9/19 Roly Fentanes <[email protected] <javascript:>>
>
>> streamA.removeAllListeners();
>> streamA.pipe(streamC);
>>
>> Really simple way to do it but if you have other event listeners on 
>> streamA besides the ones added from pipe, you'll have to re-listen.
>>
>>
>> On Tuesday, September 18, 2012 2:28:04 PM UTC-7, PierreC wrote:
>>>
>>> All,
>>>
>>> There is currently no standard way to remove a pipe set between 2 
>>> streams. Is there any (simple) solution/module to achieve that?
>>>
>>> The problem I am running into is as follow:
>>>
>>> streamA.pipe( streamB )
>>>
>>>
>>> At some point, I need to change the target of streamA from streamB to 
>>> streamC but without killing streamA (it is an expensive to setup 
>>> connection). Something along the lines of:
>>>
>>> streamA.unpipe( streamB )
>>> streamA.pipe( streamC )
>>>
>>>
>>> I have tried hacking the Stream class but without any satisfactory 
>>> result... Any idea?
>>>
>>> Cheers,
>>>
>>> Pierre
>>>
>>
>> -- 
>> 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]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>
> -- 
> 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] <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
>
>

-- 
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

Reply via email to