Skip to content

Commit

Permalink
fs: use async writeFile in FileHandle#appendFile
Browse files Browse the repository at this point in the history
When operating on a FileHandle, the file has already been opened with
the flag given as an option to fs.promises.open(). This means defaulting
to 'a' has no effect here, and FileHandle#appendFile turns out to
exactly be an alias of writeFile. This is now explicit, saving a stack
frame, object copy and assignment.

PR-URL: #31235
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Anto Aravinth <[email protected]>
  • Loading branch information
bengl authored and MylesBorins committed Jan 16, 2020
1 parent ca51ff8 commit 57016b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/fs/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class FileHandle {
}

appendFile(data, options) {
return appendFile(this, data, options);
return writeFile(this, data, options);
}

chmod(mode) {
Expand Down

0 comments on commit 57016b9

Please sign in to comment.