From b2d66566cd395627e931531fa421d473b0bcec5e Mon Sep 17 00:00:00 2001 From: Charlike Mike Reagent Date: Thu, 28 Nov 2019 06:03:11 +0200 Subject: [PATCH] exposing file writable stream errors (from #316_ thanks to #316 by @gabipetrovay, closes #469, possible fix #470 too Co-authored-by: gabipetrovay --- lib/file.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/file.js b/lib/file.js index 50d34c09..d0043a76 100644 --- a/lib/file.js +++ b/lib/file.js @@ -31,7 +31,11 @@ module.exports = File; util.inherits(File, EventEmitter); File.prototype.open = function() { + var self = this; this._writeStream = new fs.WriteStream(this.path); + this._writeStream.on('error', function(err) { + self.emit('error', err); + }); }; File.prototype.toJSON = function() {