fs: use async writeFile in FileHandle#appendFile

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: https://github.com/nodejs/node/pull/31235
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
Bryan English 2020-01-06 21:39:10 -05:00 committed by Rich Trott
parent a566c05a49
commit 73a9c37307
1 changed files with 1 additions and 1 deletions

View File

@ -70,7 +70,7 @@ class FileHandle {
}
appendFile(data, options) {
return appendFile(this, data, options);
return writeFile(this, data, options);
}
chmod(mode) {