Created
March 2, 2015 08:47
-
-
Save anonymous/e64ac6f54c28b29d982e to your computer and use it in GitHub Desktop.
This file contains 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
var stream = require('stream'); | |
var timer = new stream.Readable({ | |
read: function() { | |
var self = this; | |
console.log('called'); | |
setTimeout(function() { | |
self.push('ping'); | |
console.log('pushed'); | |
}, 100); | |
} | |
}); | |
timer.pipe(process.stdout); | |
setTimeout(function() { | |
timer.unpipe(); | |
}, 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment