You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
5 years ago | |
|---|---|---|
| .. | ||
| node_modules | 5 years ago | |
| .npmignore | 5 years ago | |
| README.md | 5 years ago | |
| index.js | 5 years ago | |
| package.co | 5 years ago | |
| package.json | 5 years ago | |
| remove.co | 5 years ago | |
| remove.js | 5 years ago | |
| test.co | 5 years ago | |
README.md
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 :
falseBoolean — Log all errors and print each path just before it's removed. - sequential :
falseBoolean — If true, remove the supplied paths sequentially, such that an unsuppressed error would short-circuit further deletes. - ignoreErrors :
falseBoolean — If false, halt as soon as possible after an error occurs and invoke the callback. When operating insequentialmode, this implies an error removing the first of several paths would halt before touching the rest. If set,ignoreErrorsoverridesignoreMissing. - ignoreMissing :
falseBoolean — Whether to treat missing paths as errors.
- verbose :
- 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 :
falseBoolean — Log all errors and print each path just before it's removed. - ignoreErrors :
falseBoolean — 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,ignoreErrorsoverridesignoreMissing. - ignoreMissing :
falseBoolean — Whether to treat missing paths as errors.
- verbose :
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.