Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Created November 23, 2012 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TooTallNate/e5e9c3b41d3d56e1ca56 to your computer and use it in GitHub Desktop.
Save TooTallNate/e5e9c3b41d3d56e1ca56 to your computer and use it in GitHub Desktop.
var Readable = require('stream').Readable;
var r = new Readable({ lowWaterMark: 0 });
r._read = function (bytes, done) {
console.error('read %d bytes', bytes);
done(null, Buffer('test'));
};
r.on('readable', function () {
console.error('readable event');
});
// unnecessary hack?
//r.read(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment