Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 39caa6d

Browse filesBrowse files
JacksonTianaddaleax
authored andcommitted
fs: use _final() for fs.WriteStream
use _final() method instead of once 'finish' event. PR-URL: #20562 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ccf69dd commit 39caa6d
Copy full SHA for 39caa6d

File tree

Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-7
lines changed
Open diff view settings
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,17 +2212,17 @@ function WriteStream(path, options) {
22122212

22132213
if (typeof this.fd !== 'number')
22142214
this.open();
2215-
2216-
// dispose on finish.
2217-
this.once('finish', function() {
2218-
if (this.autoClose) {
2219-
this.destroy();
2220-
}
2221-
});
22222215
}
22232216

22242217
fs.FileWriteStream = fs.WriteStream; // support the legacy name
22252218

2219+
WriteStream.prototype._final = function(callback) {
2220+
if (this.autoClose) {
2221+
this.destroy();
2222+
}
2223+
2224+
callback();
2225+
};
22262226

22272227
WriteStream.prototype.open = function() {
22282228
fs.open(this.path, this.flags, this.mode, (er, fd) => {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.