I have my following code:
var fs = require('fs');
var myReadStream = fs.createReadStream('readMe.txt')
myReadStream.on('data', function(data_chunk){
setTimeout(function(){
console.log('chunk read:')
console.log(data_chunk)
},2000)
})
What this does is wait 2 seconds in the beginning and then outputs all the chunks together. What I want to do is everytime a chunk is read and output I want it to wait to 2 seconds before next read and output. How do I modify my code?