From e01c1d700d9fdb197ea40a444ebd228337a7dd6e Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Wed, 4 Oct 2023 09:10:30 -0400 Subject: [PATCH] fs: add flush option to writeFile() functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds a 'flush' option to the fs.writeFile family of functions. Refs: https://github.com/nodejs/node/issues/49886 PR-URL: https://github.com/nodejs/node/pull/50009 Reviewed-By: Matteo Collina Reviewed-By: Michaƫl Zasso Reviewed-By: LiviaMedeiros Reviewed-By: Daijiro Wachi --- doc/api/fs.md | 20 +++- lib/fs.js | 59 +++++++++-- lib/internal/fs/promises.js | 31 +++++- test/parallel/test-fs-write-file-flush.js | 114 ++++++++++++++++++++++ 4 files changed, 210 insertions(+), 14 deletions(-) create mode 100644 test/parallel/test-fs-write-file-flush.js diff --git a/doc/api/fs.md b/doc/api/fs.md index 34d10418b2acc8..76f6432212654f 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1742,6 +1742,9 @@ All the [caveats][] for `fs.watch()` also apply to `fsPromises.watch()`.