> There is no 'data' event. There is a read() method, and a 'readable' event. You call read() until it returns null, and then wait for a readable event to tell you it's time to read() more.
So, if we want to pump it at max rate we would run a tight loop to read and write in the beginning and then on every readable event? It seems like more work and a lot messier compared to the old data event scheme. On Sat, Oct 13, 2012 at 5:08 PM, Alexey Petrushin < [email protected]> wrote: > Thanks for help, especially You Isaac for such a detailed answer. > > As far as I understand it's possible to wrap existing evented stream API > into callback interface (with in-memory data buffers to handle mismatch > between explicit/implicit control flow). > But probably it won't worth it, it will be more easy to just use it as > it's supposed to be used (with pipes) and wait untill those changes in 0.10. > The new API seems to be very similar to what I asked for. > > P.S. > > As for the question and why do I need it - I'm working on application that > uses custom streams and though that maybe I can cheat and simplify my work > a little by not implementing complex evented interface :). > > I once used such abstraction for working with streams in ruby: > > to.write do |writer| > from.read{|buff| writer.write buff} > end > > Files are open and closed properly, buffer also have some default size, so > the code is very simple to use (more details > http://alexeypetrushin.github.com/vfs ). > Basically by implementing just those two methods You get ability to stream > from any stream into any stream (fs, s3, sftp, ...). > > I tried to do something similar with asynchronous streams. > > -- > 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
