Skip to content

Instantly share code, notes, and snippets.

@AndreasMadsen
Forked from anonymous/gist:419c1ca6ed040a409cfc
Last active August 29, 2015 14:18
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 AndreasMadsen/17c9e6683d795434c5e1 to your computer and use it in GitHub Desktop.
Save AndreasMadsen/17c9e6683d795434c5e1 to your computer and use it in GitHub Desktop.
var stream = require('stream');
var s = new stream.Readable({
highWaterMark: 20,
read: function() {
setImmediate(this.push.bind(this, 'abc'));
}
});
s.pipe(process.stdout);
setTimeout(function () {
s.unpipe(process.stdout);
}, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment