2.0.0 • Published 9 years ago

rimraf-promise v2.0.0

Weekly downloads
2,126
License
MIT
Repository
github
Last release
9 years ago

rimraf-promise

NPM version Build Status Build status Coverage Status Dependency Status devDependency Status

Promises/A+ version of rimraf:

rm -rf for node.

const rimrafPromise = require('rimraf-promise');

rimrafPromise('path/should/be/removed')
.then(() => console.log('File has been removed successfully.'))
.catch(console.error);

Installation

Use npm.

npm install rimraf-promise

API

const rimrafPromise = require('rimraf-promise');

rimrafPromise(path , options)

path: String (a file/directory path or glob pattern)
options: Object (rimraf options)
Return: Object (Promise)

When it finish removing the target, it will be fulfilled with no arguments.

When it fails to remove the target, it will be rejected with an error as its first argument. Here is the details about how rimraf handles its error.

const rirmafPromise = require('rimraf-promise');

const onFulfilled = () => console.log('Done.');
const onRejected = err => console.error(err);

rirmafPromise('path/to/file').then(onFulfilled, onRejected);

License

The Unlicense