.read(n, fn) would be way nicer IMO but I'm not sure if that maybe misses some use-case or would make things more difficult backwards compatibility-wise, but the current "readable" thing seems wonky
On Monday, 1 July 2013 06:23:44 UTC-7, Gil Pedersen wrote: > > Hi, > > I have a case where I want to consume a Readable, by: > > 1. Read n bytes. > 2. Process buffer using a function with an async callback. > 3. When callback completes, goto 1. > > I fail to see any simple solution to what I feel must be a somewhat common > use case. The standard "on('readable', function() { this.read(); ... })" > doesn't apply, as I have no way of deferring future 'readable' emits once I > have returned from the handler. > > Can it really be that the most sensible solution is to fall back to the > old API, using pause() and resume()? or have I missed something? > > Regards, > Gil -- -- 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 --- 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 nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.