Skip to content

Commit c9d82ec

Browse files
committed
fs: use arrow function for lexical this
Refs nodejs#7414
1 parent a275856 commit c9d82ec

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/fs.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -1708,20 +1708,19 @@ function ReadStream(path, options) {
17081708
fs.FileReadStream = fs.ReadStream; // support the legacy name
17091709

17101710
ReadStream.prototype.open = function() {
1711-
var self = this;
1712-
fs.open(this.path, this.flags, this.mode, function(er, fd) {
1711+
fs.open(this.path, this.flags, this.mode, (er, fd) => {
17131712
if (er) {
1714-
if (self.autoClose) {
1715-
self.destroy();
1713+
if (this.autoClose) {
1714+
this.destroy();
17161715
}
1717-
self.emit('error', er);
1716+
this.emit('error', er);
17181717
return;
17191718
}
17201719

1721-
self.fd = fd;
1722-
self.emit('open', fd);
1720+
this.fd = fd;
1721+
this.emit('open', fd);
17231722
// start the flow of data.
1724-
self.read();
1723+
this.read();
17251724
});
17261725
};
17271726

0 commit comments

Comments
 (0)