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 <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
  • Loading branch information
bengl authored and codebytere committed Mar 14, 2020
1 parent 31a13dc commit 73c4729
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 73c4729

Please sign in to comment.