remove

Sync and async rm -r.

remove downloads remove version remove license

remove类似的npm包:
npm下载趋势
3 年
🌟 在 remove 的 README.md 中显示实时使用量图表,只需复制下面的代码。
## Usage Trend
[![Usage Trend of remove](https://npm-compare.com/img/npm-trend/THREE_YEARS/remove.png)](https://npm-compare.com/remove#timeRange=THREE_YEARS)
Cumulative GitHub Star Trend
🌟 在 remove 的 README.md 中显示 GitHub stars 趋势图表,只需复制下面的代码。
## GitHub Stars Trend
[![GitHub Stars Trend of remove](https://npm-compare.com/img/github-trend/remove.png)](https://npm-compare.com/remove)
统计详情
npm包名称
下载量
Stars
大小
Issues
发布时间
License
remove100,91211-313 年前MIT
remove的README

node-remove

Sync and async versions of rm -r, handling both files and directories (something astonishingly missing from fs).

var remove = require('remove');

// Asynchronous
remove('/home/esr', function(err){
    if (err) console.error(err);
    else     console.log('success!');
});

// Synchronous
try {
    remove.removeSync('/home/esr');
    console.log('success!');
} catch (err) {
    console.error(err);
}

Installation

Via npm:

npm install remove

Or if you want to hack on the source:

git clone https://github.com/dsc/node-remove.git
cd node-remove
npm link

API

remove(paths, [options], cb) -> void

remove.removeAsync(paths, [options], cb) -> void

Asynchronously and recursively remove files and/or directories.

  • paths String | Array<String> — Path or paths to remove.
  • options Object — Options object:
    • verbose : false Boolean — Log all errors and print each path just before it's removed.
    • sequential : false Boolean — If true, remove the supplied paths sequentially, such that an unsuppressed error would short-circuit further deletes.
    • ignoreErrors : false Boolean — If false, halt as soon as possible after an error occurs and invoke the callback. When operating in sequential mode, this implies an error removing the first of several paths would halt before touching the rest. If set, ignoreErrors overrides ignoreMissing.
    • ignoreMissing : false Boolean — Whether to treat missing paths as errors.
  • callback Function — Completion callback, invoked with null on success and the error on failure.

removeSync(paths, [options]) -> void

Synchronously and recursively remove files and/or directories.

  • paths String | Array<String> — Path or paths to remove.
  • options Object — Options (all optional):
    • verbose : false Boolean — Log all errors and print each path just before it's removed.
    • ignoreErrors : false Boolean — If false, halt as soon as possible after an error occurs and invoke the callback. This implies an error removing the first of several paths would halt before touching the rest. If set, ignoreErrors overrides ignoreMissing.
    • ignoreMissing : false Boolean — Whether to treat missing paths as errors.

Feedback

Find a bug or want to contribute? Open a ticket on github. You're also welcome to send me email at dsc@less.ly.