Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict';
var stream = require('stream');
var timer = new stream.Readable({
highWaterMark: 1,
read: function() {
console.log('read');
var self = this;
//console.log('called');
setTimeout(function() {
self.push('ping');
//console.log('pushed');
}, 100);
}
});
timer.pipe(process.stdout);
setTimeout(function() {
timer.unpipe(process.stdout);
console.log('unpipe');
}, 500);
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.