Skip to content

Commit

Permalink
fs: use arrow function for lexical this
Browse files Browse the repository at this point in the history
  • Loading branch information
originalfoo committed Jun 25, 2016
1 parent a275856 commit c9d82ec
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
};

Expand Down

0 comments on commit c9d82ec

Please sign in to comment.