rimraf
Simple rimraf with promise support 🎉
Uses @alexbinary/promisify by alexbinary
Install
Install using npm or yarn :
$ npm install @alexbinary/rimraf
# or
$ yarn add @alexbinary/rimraf
Usage
let rimraf = require('@alexbinary/rimraf')
// promise
rimraf('/foo/bar').then(() => {
console.log('file deleted')
})
// callback
rimraf('/foo/bar', (err) => {
if (!err) {
console.log('file deleted')
}
})
// sync
rimraf.sync('/foo/bar')
console.log('file deleted')
Documentation
let rimraf = require('@alexbinary/rimraf')
rimraf(filepath[, callback])
Removes the file or directory at filepath
.
If filepath
is a directory then the directory is removed with all its content.
This method supports both Promise and node callback style, and resolves with no arguments.
rimraf.sync(filepath)
Synchronous version.
Licence
MIT