I have written below code in streamreader.js file.
var fs = require("fs");
var readStream;
try
{
readStream=fs.createReadStream("hello.txt");
readStream.on('data',function(data){
console.log(data);
});
readStream.on('end',function(){
console.load('file ended');
});
}
catch(err)
{
readStream.on('error',function()
{
console.log(err);
});
}
but when i try to run this file using >node streamreader.js
I am getting below error.
events.js:48
throw arguments[1]; // Unhandled 'error' even
^
Error: ENOENT, The operation completed successfully.
'hello.txt'
Can you help me to resolve this issue?