Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorIan Sutherland <ian@iansutherland.ca>2020-10-04 05:20:28 +0300
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2020-10-14 01:58:05 +0300
commit1610728d7c04884c9f68c28e6602418936e02b50 (patch)
treec712d2e7e7c16b0bd8022d51a9c7c6ecadc682fb /doc
parentf552e5c2512db6fcb9be25c5e1f697393a374ad3 (diff)
fs: add rm method
This PR introduces a new method fs.rm that provides the behaviour of rimraf when used with the recursive: true and force: true options. PR-URL: https://github.com/nodejs/node/pull/35494 Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/errors.md5
-rw-r--r--doc/api/fs.md87
2 files changed, 83 insertions, 9 deletions
diff --git a/doc/api/errors.md b/doc/api/errors.md
index 7e172d58d7f..7e356f10013 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.
+<a id="ERR_FS_EISDIR"></a>
+### `ERR_FS_EISDIR`
+
+Path is a directory.
+
<a id="ERR_FS_FILE_TOO_LARGE"></a>
### `ERR_FS_FILE_TOO_LARGE`
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 36d3fc10f4d..db3e41e1ee1 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)`
+<!-- YAML
+added: REPLACEME
+-->
+
+* `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])`
+<!-- YAML
+added: REPLACEME
+-->
+
+* `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)`
<!-- YAML
added: v0.0.2
@@ -5447,9 +5494,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`.
@@ -5471,6 +5518,28 @@ that represent files will be deleted. The permissive behavior of the
`recursive` option is deprecated, `ENOTDIR` and `ENOENT` will be thrown in
the future.
+## `fsPromises.rm(path[, options])`
+<!-- YAML
+added: REPLACEME
+-->
+
+* `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])`
<!-- YAML
added: v10.0.0