Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread SethP
It does buffer but it doesn't have to - it could easily be modified to instead push back by returning false on write(); this is functionality we've considered but haven't yet needed. We need the pipe() implementation because the one in node stream appears to be broken - tests consistently fail

Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread Marco Rogers
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 t

Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread SethP
Thanks, I did implement my own stream for this reason: https://github.com/capsela/capsela-util/blob/master/lib/Pipe.js I was just wondering if that was in fact the best way to do it, or if I was missing something. I'm getting the impression it's the best way to do it, since the only alternative

Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread Adam Crabtree
As far as I understand it, util.pump is deprecated in favor of stream.pipe: https://groups.google.com/group/nodejs/browse_thread/thread/17074342f01fe313 Also see this deck from Felix: http://felixge.s3.amazonaws.com/11/nodejs-streams.pdf and his passthrough stream example: github.com/felixge/no

Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread Chris Rhoden
As much as I know this is not the answer you're looking for (as it's not very easy), that's a pipe. On Wed, Feb 1, 2012 at 8:38 AM, SethP wrote: > I don't think so - that's a way to move data from a read stream to a write > stream; I'm looking for the inverse: a way to move data from a write str

Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread Diogo Resende
On Wed, 1 Feb 2012 05:38:38 -0800 (PST), SethP wrote: I don't think so - that's a way to move data from a read stream to a write stream; I'm looking for the inverse: a way to move data from a write stream to a read stream. I'm not sure I follow what you mean. I thought stream.pipe would solve a

Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread SethP
I don't think so - that's a way to move data from a read stream to a write stream; I'm looking for the inverse: a way to move data from a write stream to a read stream. -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines

Re: [nodejs] Re: Best way to make a read/write stream?

2012-02-01 Thread Taka Kojima
It's marked as experimental, but I believe you're looking for something like this: http://nodejs.org/docs/latest/api/util.html#util.pump On Tue, Jan 31, 2012 at 7:24 PM, SethP wrote: > Thanks - I was aware of that one; it's basically a simpler version of the > Pipe approach: > https://github.co

[nodejs] Re: Best way to make a read/write stream?

2012-01-31 Thread SethP
Thanks - I was aware of that one; it's basically a simpler version of the Pipe approach: https://github.com/capsela/capsela-util/blob/master/lib/Pipe.js I was wondering if I was missing something or if that's just the best way to do it. -- Job Board: http://jobs.nodejs.org/ Posting guidelines:

[nodejs] Re: Best way to make a read/write stream?

2012-01-31 Thread mscdex
On Jan 31, 6:11 pm, SethP wrote: > In our tests we often need read/write streams because if the code > under test is reading a stream then the test needs to write to it and > vice-versa. I'm guessing this is a common problem, but I'm not aware > of a common solution - how are people tackling this?