For example, a file which the current user doesn't have access to read. The error listener on the reader itself doesn't see the resulting EACCESS; it just crashes the process.
$ cat fstream-test.js
var fstream = require('fstream');
var devnull = require('fs').createWriteStream('/dev/null');
var reader = fstream.Reader('./stuff');
reader.on('error', function(e) {
console.warn("Caught error from reader: " + e);
});
reader.pipe(devnull);
$ mkdir stuff
$ sudo bash -c "umask 077; touch stuff/other"
$ ll stuff/
total 0
-rw------- 1 root root 0 Nov 20 15:15 other
$ node fstream-test.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: EACCES, open '/tmp/stuff/other'
For example, a file which the current user doesn't have access to read. The
error
listener on the reader itself doesn't see the resulting EACCESS; it just crashes the process.