Skip to content

events.js:48 throw arguments[1]; // Unhandled 'error' event #641

Description

@vmrathod

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions