It looks like what you're created here is a BufferedStream. A read/write 
stream that sits between a readstream and a writestream and allows you to 
pause/resume and will by buffering data. That's great and I'm finding that 
people really need this. I wrote one a while back and tried to get some 
traction behind it, but the core guys are not very keen on buffering data 
(for good reason, but I think they're coming around).

Anyway, this is a good implementation. The only thing I would suggest is 
that you not re-implement the pipe method. That is what the stream module 
is for, so you should just have your custom stream inherit from 
require('stream').Stream.

Also a minor detail, but I don't think you should turn the data back into a 
Buffer object if it's already a string. These types of things should 
provide singular functionality and not mess with the data if it's not 
absolutely necessary. Of course your use case may dictate otherwise.

Checkout this more general implementation of a 
BufferedStream. https://github.com/mjijackson/bufferedstream

:Marco

-- 
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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to