In this bit: return this._generator(size, function(e, buffer) { if (me.push(buffer)) process.nextTick(function() { return me._read(size); // nextTick prevent call stack explode for fast tty }); });
there's no need to call `me._read(size)` again. The Readable impl will do that for you if necessary. Also, looks like you're ignoring the error, that's probably not so good! You can replace it with this: return this._generator(size, function(e, buffer) { if (e) me.emit('error', e); else me.push(buffer); }); On Mon, Apr 8, 2013 at 12:19 AM, Chakrit Wichian <konsh...@chakrit.net> wrote: > Wrote this to test actual HTTP download speed. > > Thought this might be useful to some as a generic testing tool. > > Check out the README on GitHub if you are interested: > > https://github.com/chakrit/randstream > > Also provides a `rand` command line for generating random bytes in the shell > if installed with `-g` > > > - chakrit > http://chakr.it > > -- > -- > 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. > > -- -- 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.