Skip to content

Commit

Permalink
Manage err from stream
Browse files Browse the repository at this point in the history
  • Loading branch information
rlanore committed Aug 6, 2015
1 parent d61da1b commit 152269f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/readfilesstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,13 @@ function readFilesStream(dir, options, callback, complete) {
if (options.shortName) files.push(filename);
else files.push(file);
var stream = fs.createReadStream(file);
stream.on('error',function(err) {
return done(err);
});
if (callback.length > 3)
if (options.shortName) callback(null, stream, filename, next);
else callback(null, stream, file, next);
else callback(null, stream, next);
/*01
fs.readFile(file, options.encoding, function(err, data) {
if (err) return done(err);
if (callback.length > 3)
if (options.shortName) callback(null, data, filename, next);
else callback(null, data, file, next);
else callback(null, data, next);
});
*/
}
});
})();
Expand Down

0 comments on commit 152269f

Please sign in to comment.