I'm not too much into the node specifics of streams, but I say.

If its an expected end, call close.
If its an unexpected end, call error then close,
if someone calls write after close, throw an error. Since this should
never happen in a correctly written application, if its okay it
terminates if this is not catched.

On Fri, Jun 1, 2012 at 7:54 AM, Dominic Tarr <[email protected]> wrote:
> what should a writable stream do if it's underlieing communication layer 
> closes?
> I see that .pipe listens on the end event of both source and dest streams,
>
> https://github.com/joyent/node/blob/master/lib/stream.js#L109
>
> what should the WritableStream do if write is called after 'close' is
> emitted? emit an 'error'?
>
> how should someone writing to a stream know that the stream is closed?
> listen on 'close'? or 'error'? or check stream.writable befor writing?
>
> what is the best way?
>
> cheers, Dominic
>
> --
> 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

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