Node.js implementation of rm -fr
– recursive removal of files and directories
const rmfr = require('rmfr');
(async () => await rmfr('path/to/target'))();
npm install rmfr
const rmfr = require('rmfr');
path: string
(a file/directory path)
options: Object
Return: Promise
When it finish removing a target, it will be fulfilled with no arguments.
When it fails to remove a target, it will be rejected with an error as its first argument.
All rimraf
options except for disableGlob
are available, with some differences:
glob
option defaults tofalse
.- If you want to specify targets using glob pattern, set
glob
optiontrue
or provide anode-glob
options object.
- If you want to specify targets using glob pattern, set
unlink
,chmod
,rmdir
andreaddir
options default to the correspondinggraceful-fs
methods.
const rmfr = require('rmfr');
rmfr('inde*.js'); // doesn't remove `./index.js`
rmfr('inde*.js', {glob: true}); // removes `./index.js`
ISC License © 2017 - 2018 Shinnosuke Watanabe