From 73a9c37307026e46a818a06cc3a375d4d02e65b7 Mon Sep 17 00:00:00 2001 From: Bryan English Date: Mon, 6 Jan 2020 21:39:10 -0500 Subject: [PATCH] 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 Reviewed-By: Anto Aravinth --- lib/internal/fs/promises.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 785d0b082cc1a2..65e4fdb63c7ecb 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -70,7 +70,7 @@ class FileHandle { } appendFile(data, options) { - return appendFile(this, data, options); + return writeFile(this, data, options); } chmod(mode) {