Skip to content

Instantly share code, notes, and snippets.

@isaacs isaacs/r.js
Created Jan 13, 2013

Embed
What would you like to do?
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
You can’t perform that action at this time.