I also find that implementing a custom Writable stream (one callback) is easier than the .read() function that we have now (event, synchronous function with inconsistent return value). I've brought up my concerns about .read() before[0] but unfortunately it was too late and now we're stuck with what we got.
So in short, *no*, I don't think there's any benefit for using the .read() function directly rather than implementing a separate Writable class. As far as I'm concerned the only API for consuming readables is .pipe(). 0: https://github.com/joyent/node/pull/4835#issuecomment-14024535 On Mon, Mar 18, 2013 at 11:06 AM, Sigurgeir Jonsson < [email protected]> wrote: > The new streams have excellent support for high/low watermarks and > auto-pausing/resuming, but the documentation confuses me a little... > particularly the read method. > > When I read the new docs for the first time I was under the impression > that the optimal way to become a user of a stream is to write loops around > the read functio. However in practice I find myself simply writing custom > writeStreams and use the callback to control upstream pressure (in addition > to source Watermarks if needed). Here is an example where I move the > output to a queue that executes a custom function in parallel (i.e. > uploading to a database) https://gist.github.com/ZJONSSON/5189249 > > Are there any benefits to using the read method directly on a stream vs. > piping to a custom Writable stream? > > -- > -- > 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. > > > -- -- 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.
