From 59fff925beb56efe09b66f62dee6acb6900d9d8b Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 6 Sep 2021 11:33:10 +0200 Subject: [PATCH] fs: make `open` and `close` stream override optional when unused When using `createReadStream` or `createWriteStream` with a specific file descriptor or `FileHandle` instead of a path, `open` method is not used, there is no point in forcing users to provide it. When using `createReadStream` or `createWriteStream` with `autoClose` set to false, `close` method is not used, there is no point in forcing users to provide it. PR-URL: https://github.com/nodejs/node/pull/40013 Reviewed-By: James M Snell --- doc/api/fs.md | 22 ++++++- lib/internal/fs/streams.js | 114 +++++++++++++++++++------------------ 2 files changed, 77 insertions(+), 59 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 0cb93871b9924e..37fb8143497ced 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1887,6 +1887,12 @@ behavior is similar to `cp dir1/ dir2/`.