Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rimraf-promise

shinnn1.4kMITdeprecated2.0.0

renamed to rmfr with some improvements. https://github.com/shinnn/rmfr

Promises/A+ version of rimraf

rimraf, rm, rmdir, unlink, remove, clean, recursive, glob, file, directory, promise, promisified, then, thenable

readme

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