Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/appgeist/ensure-dir

Utility function to ensure a directory path exists and return a Promise
https://github.com/appgeist/ensure-dir

check create directory filesystem mkdirp nodejs promise server-side shell utilities

Last synced: about 2 months ago
JSON representation

Utility function to ensure a directory path exists and return a Promise

Awesome Lists containing this project

README

        

# @appgeist/ensure-dir

[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]

Utility function to ensure a directory path exists and return a Promise.
Uses [mkdirp](https://www.npmjs.com/package/mkdirp) under the hood.

## Usage

```js
const ensureDir = require("@appgeist/ensure-dir");

await ensureDir("/folder/to/store/lotsa/files");
```

### Why not [mkdirp-promise](https://www.npmjs.com/package/mkdirp-promise)?

@appgeist/ensure-dir should be slightly more efficient than [mkdirp-promise](https://www.npmjs.com/package/mkdirp-promise) because it checks whether the specified path exists before trying to create it.

## License

The [ISC License](LICENSE).

[npm-image]: https://img.shields.io/npm/v/@appgeist/ensure-dir.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@appgeist/ensure-dir
[license-image]: https://img.shields.io/npm/l/@appgeist/ensure-dir.svg?style=flat-square
[license-url]: LICENSE