Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created January 13, 2013 02:03
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save isaacs/4521829 to your computer and use it in GitHub Desktop.
var Readable = require('stream').Readable;
var r = new Readable({
lowWaterMark: 3,
highWaterMark: 10
});
var calls = 0;
r._read = function (n, cb) {
console.log("_read", this._readableState.length,
this._readableState.lowWaterMark,
this._readableState.highWaterMark)
calls++;
cb(null, new Buffer('x'));
};
// touch to cause it
r.read(0)
// _read 0 3 10
// _read 1 3 10
// _read 2 3 10
// _read 3 3 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment