Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dzek69/rmdir-promise
Promisified `rmdir` npm module.
https://github.com/dzek69/rmdir-promise
es6 javascript node npm promise promises rmdir
Last synced: about 19 hours ago
JSON representation
Promisified `rmdir` npm module.
- Host: GitHub
- URL: https://github.com/dzek69/rmdir-promise
- Owner: dzek69
- License: mit
- Created: 2017-12-11T21:20:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-09T12:08:49.000Z (almost 2 years ago)
- Last Synced: 2025-01-07T12:08:46.901Z (7 days ago)
- Topics: es6, javascript, node, npm, promise, promises, rmdir
- Language: JavaScript
- Homepage:
- Size: 134 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# rmdir-promise
Promisified `rmdir` npm module for cleaner code.
## Features
- enables `await rmdir("dir");` syntax
- includes `rmdir.silent` method that ignores specific error where directory does not exist
- es6+ first approach, with es5 transpiled version to be found inside `dist` folder (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
1. Install it: `yarn add rmdir-promise` or `npm install rmdir-promise --save`
1. Use it like that:
```javascript
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
1. Clone repo
1. Run `yarn test` or `npm test`## To be done
1. Replace `jsdoc` docs with something better
## License
MIT