Last active
December 11, 2015 11:38
-
-
Save nickleefly/4594793 to your computer and use it in GitHub Desktop.
createReadStream
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
var fs = require('fs'); | |
var readStream = fs.createReadStream('/Users/asus/Documents/work/script.js'); | |
readStream.pause(); | |
readStream.on('data', function(data) { | |
console.log('got some data:', data); | |
readStream.pause(); | |
setTimeout(function() { | |
readStream.resume(); | |
}, 100); | |
}); | |
readStream.on('end', function() { | |
console.log('ended'); | |
}); | |
//readStream.setEncoding('base64'); | |
setTimeout(function() { | |
readStream.resume(); | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment