-
-
Save AndreasMadsen/36692deccfcf474854e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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