rmdir-promise
v1.0.0
Published
Promisified `rmdir` npm module for cleaner code.
Downloads
9
Readme
rmdir-promise
Promisified rmdir npm module for cleaner code.
Features
- enables
await rmdir("dir");syntax - includes
rmdir.silentmethod that ignores specific error where directory does not exist - es6+ first approach, with es5 transpiled version to be found inside
distfolder (for node 4.0.0) *
* - transpiling kills JS engines optimizations, makes codes longer and tree shaking harder to do and/or slower and yes, bundling server code makes sense too :)
Installation and usage
- Install it:
yarn add rmdir-promiseornpm install rmdir-promise --save - Use it like that:
const rmdir = require("rmdir-promise");
rmdir("temp").then(() => {
console.log("Temporary directory removed!");
}, () => {
console.error("We can't remove `temp`");
});
// or for silent version and async syntax:
const { silent: rmdir } = require("rmdir-promise");
(async () => {
try {
await rmdir("temp");
}
catch(e) {
console.error("We can't remove `temp`");
}
console.log("Temporary directory removed!");
})();Unit tests
- Clone repo
- Run
yarn testornpm test
To be done
- Replace
jsdocdocs with something better
License
MIT
