rimraf-promise

Promises/A+ version of rimraf

MIT 3 个版本
安装
npm install rimraf-promise
yarn add rimraf-promise
pnpm add rimraf-promise
bun add rimraf-promise
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

版本列表
2.0.0 2015-10-20
1.0.0 2014-10-17
0.0.0 2014-10-16