diff --git a/doc/api/errors.md b/doc/api/errors.md index 7e172d58d7fe3a..7e356f1001318a 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -928,6 +928,11 @@ added: v14.0.0 Used when a feature that is not available to the current platform which is running Node.js is used. + +### `ERR_FS_EISDIR` + +Path is a directory. + ### `ERR_FS_FILE_TOO_LARGE` diff --git a/doc/api/fs.md b/doc/api/fs.md index 36d3fc10f4df54..db3e41e1ee17e0 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -3509,9 +3509,9 @@ changes: * `options` {Object} * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or `EPERM` error is encountered, Node.js will retry the operation with a linear - backoff wait of `retryDelay` ms longer on each try. This option represents - the number of retries. This option is ignored if the `recursive` option is - not `true`. **Default:** `0`. + backoff wait of `retryDelay` milliseconds longer on each try. This option + represents the number of retries. This option is ignored if the `recursive` + option is not `true`. **Default:** `0`. * `recursive` {boolean} If `true`, perform a recursive directory removal. In recursive mode, errors are not reported if `path` does not exist, and operations are retried on failure. **Default:** `false`. @@ -3560,9 +3560,9 @@ changes: * `options` {Object} * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or `EPERM` error is encountered, Node.js will retry the operation with a linear - backoff wait of `retryDelay` ms longer on each try. This option represents - the number of retries. This option is ignored if the `recursive` option is - not `true`. **Default:** `0`. + backoff wait of `retryDelay` milliseconds longer on each try. This option + represents the number of retries. This option is ignored if the `recursive` + option is not `true`. **Default:** `0`. * `recursive` {boolean} If `true`, perform a recursive directory removal. In recursive mode, errors are not reported if `path` does not exist, and operations are retried on failure. **Default:** `false`. @@ -3581,6 +3581,53 @@ that represent files will be deleted. The permissive behavior of the `recursive` option is deprecated, `ENOTDIR` and `ENOENT` will be thrown in the future. +## `fs.rm(path[, options], callback)` + + +* `path` {string|Buffer|URL} +* `options` {Object} + * `force` don't error on nonexistent path + * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + `EPERM` error is encountered, Node.js will retry the operation with a linear + backoff wait of `retryDelay` milliseconds longer on each try. This option + represents the number of retries. This option is ignored if the `recursive` + option is not `true`. **Default:** `0`. + * `recursive` {boolean} If `true`, perform a recursive removal. In + recursive mode operations are retried on failure. **Default:** `false`. + * `retryDelay` {integer} The amount of time in milliseconds to wait between + retries. This option is ignored if the `recursive` option is not `true`. + **Default:** `100`. +* `callback` {Function} + * `err` {Error} + +Asynchronously removes files and directories (modeled on the standard POSIX `rm` +utility). No arguments other than a possible exception are given to the +completion callback. + +## `fs.rmSync(path[, options])` + + +* `path` {string|Buffer|URL} +* `options` {Object} + * `force` Ignore errors + * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + `EPERM` error is encountered, Node.js will retry the operation with a linear + backoff wait of `retryDelay` milliseconds longer on each try. This option + represents the number of retries. This option is ignored if the `recursive` + option is not `true`. **Default:** `0`. + * `recursive` {boolean} If `true`, perform a recursive directory removal. In + recursive mode operations are retried on failure. **Default:** `false`. + * `retryDelay` {integer} The amount of time in milliseconds to wait between + retries. This option is ignored if the `recursive` option is not `true`. + **Default:** `100`. + +Synchronously removes files and directories (modeled on the standard POSIX `rm` +utility). Returns `undefined`. + ## `fs.stat(path[, options], callback)` + +* `path` {string|Buffer|URL} +* `options` {Object} + * `force` Ignore errors + * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or + `EPERM` error is encountered, Node.js will retry the operation with a linear + backoff wait of `retryDelay` milliseconds longer on each try. This option + represents the number of retries. This option is ignored if the `recursive` + option is not `true`. **Default:** `0`. + * `recursive` {boolean} If `true`, perform a recursive directory removal. In + recursive mode operations are retried on failure. **Default:** `false`. + * `retryDelay` {integer} The amount of time in milliseconds to wait between + retries. This option is ignored if the `recursive` option is not `true`. + **Default:** `100`. + +Synchronously removes files and directories (modeled on the standard POSIX `rm` +utility). Resolves the `Promise` with no arguments on success. + ### `fsPromises.stat(path[, options])`