Listen readable stream end or error event once.
end
error
$ npm i end-or-error
var eoe = require('end-or-error'); var stream = createReadStreamSomeHow(); eoe(stream, function (err) { // err => stream emitted "error" event });
MIT