On Mon, Feb 6, 2012 at 19:09, NodeJazz <infinic...@gmail.com> wrote:
> I was not able to find a way to specify a error handler when using
> fs.createReadStream(path) for the input (static file). Is this
> possible?

Yes.

  var stream = fs.createReadStream(path, options);
  stream.on('error', function() { /* ... */ });

> So I tried a 2 step approach using
> fs.open(path, flags, mode, callback)
> and then calling
> fs.createReadStream(null, options)
> in the open callback with options.fd set approriately
>
> With this approach (err, fd) received by the callback is good at the
> beginning. But subsequently fd becomes 'undefined' and err has
> 'Error: OK, success 'C:\files\test.dat' with err.errno being 0. Why is
> fd undefined when there is no apparent error? Is there a way to view
> underlying errors if any?

What do you mean with 'fd becomes undefined'? Where/when does that
happen? A more complete code example would help.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to