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 b23a93a commit c70eeac
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1894,15 +1894,14 @@ WriteStream.prototype._write = function(data, encoding, cb) {
this._write(data, encoding, cb);
});

var self = this;
fs.write(this.fd, data, 0, data.length, this.pos, function(er, bytes) {
fs.write(this.fd, data, 0, data.length, this.pos, (er, bytes) => {
if (er) {
if (self.autoClose) {
self.destroy();
if (this.autoClose) {
this.destroy();
}
return cb(er);
}
self.bytesWritten += bytes;
this.bytesWritten += bytes;
cb();
});

Expand Down

0 comments on commit c70eeac

Please sign in to comment.