diff --git a/lib/fs.js b/lib/fs.js index b21dcc7e18679a..a4c6ddd2283ab1 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1708,20 +1708,19 @@ function ReadStream(path, options) { fs.FileReadStream = fs.ReadStream; // support the legacy name ReadStream.prototype.open = function() { - var self = this; - fs.open(this.path, this.flags, this.mode, function(er, fd) { + fs.open(this.path, this.flags, this.mode, (er, fd) => { if (er) { - if (self.autoClose) { - self.destroy(); + if (this.autoClose) { + this.destroy(); } - self.emit('error', er); + this.emit('error', er); return; } - self.fd = fd; - self.emit('open', fd); + this.fd = fd; + this.emit('open', fd); // start the flow of data. - self.read(); + this.read(); }); };