On Mon, Feb 6, 2012 at 21:13, Cosmere Infahm <infinic...@gmail.com> wrote: >> var stream = fs.createReadStream(path, options); >> stream.on('error', function() { /* ... */ }); > > Wouldn't this mean that the error handler is unlikely to be invoked in case > of an error during creation/opening of the stream?
No, because the actual work - open file, read file, etc. - doesn't start until the next iteration of the event loop (colloquially: the next tick). >> What do you mean with 'fd becomes undefined'? Where/when does that >> happen? A more complete code example would help. > > I meant that the values of (err, fd) received by the open callback change > over time. fd is >= 0 and err is null in response to the initial http > requests. After a few seconds the callback parameter values are ('Error: OK, > success 'C:,\files\test.dat', undefined). Right, I see what you mean. The system-to-node error mappings are not perfect yet, particularly on Windows with its myriad error codes. -- 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