From 972e66f3e0ce740205bb6b484a1dbc65540f40d1 Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Fri, 31 May 2024 12:14:26 -0700 Subject: [PATCH 1/2] doc: add `err` param to fs.copyFile callback --- doc/api/fs.md | 1 + lib/fs.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index e89f934f281fee..44c38ccafceade 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2388,6 +2388,7 @@ changes: * `dest` {string|Buffer|URL} destination filename of the copy operation * `mode` {integer} modifiers for copy operation. **Default:** `0`. * `callback` {Function} + * `err` {Error} Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it already exists. No arguments other than a possible exception are given to the diff --git a/lib/fs.js b/lib/fs.js index cc27b1c93a4850..b4b2a320e75f37 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -2984,7 +2984,7 @@ function mkdtempSync(prefix, options) { * @param {string | Buffer | URL} src * @param {string | Buffer | URL} dest * @param {number} [mode] - * @param {() => any} callback + * @param {(err?: Error) => any} callback * @returns {void} */ function copyFile(src, dest, mode, callback) { From da77ab798ffd2420235fae5f8b63e376aec9292d Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Fri, 31 May 2024 14:45:18 -0700 Subject: [PATCH 2/2] doc: add err param to fs.cp callback --- doc/api/fs.md | 1 + lib/fs.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 44c38ccafceade..34742f629a1daf 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2477,6 +2477,7 @@ changes: * `verbatimSymlinks` {boolean} When `true`, path resolution for symlinks will be skipped. **Default:** `false` * `callback` {Function} + * `err` {Error} Asynchronously copies the entire directory structure from `src` to `dest`, including subdirectories and files. diff --git a/lib/fs.js b/lib/fs.js index b4b2a320e75f37..f47dba6e43debb 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -3030,7 +3030,7 @@ function copyFileSync(src, dest, mode) { * @param {string | URL} src * @param {string | URL} dest * @param {object} [options] - * @param {() => any} callback + * @param {(err?: Error) => any} callback * @returns {void} */ function cp(src, dest, options, callback) {