Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a-x-/mkdirpp
Recursively mkdir, like `mkdir -p`, but in node.js (with promises)
https://github.com/a-x-/mkdirpp
fs mkdir mkdirp promise shell
Last synced: about 2 months ago
JSON representation
Recursively mkdir, like `mkdir -p`, but in node.js (with promises)
- Host: GitHub
- URL: https://github.com/a-x-/mkdirpp
- Owner: a-x-
- License: other
- Created: 2017-02-28T20:02:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-28T20:14:45.000Z (almost 8 years ago)
- Last Synced: 2024-04-14T11:57:03.879Z (9 months ago)
- Topics: fs, mkdir, mkdirp, promise, shell
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/mkdirpp
- Size: 56.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mkdirp
Like `mkdir -p`, but in node.js!
# installation
`npm i -S mkdirpp`
# example
```js
var mkdirp = require('mkdirp');
mkdirpp('/tmp/foo/bar/baz')
.then(() => console.log('pow!'))
.catch(err => console.error(err));
```Output
```
pow!
```And now `/tmp/foo/bar/baz` exists!
# methods
```js
var mkdirp = require('mkdirpp');
```## mkdirp(dir, opts) -> Promise
Create a new directory and any necessary subdirectories at `dir` with octal
permission string `opts.mode`. If `opts` is a non-object, it will be treated as
the `opts.mode`.If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
You can optionally pass in an alternate `fs` implementation by passing in
`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and
`opts.fs.stat(path, cb)`.# license
MIT
# credits
Based on [mkdirp](https://github.com/substack/node-mkdirp).
# alternatives
[mkdirp-promise](https://www.npmjs.com/package/mkdirp-promise) is an extremely thin wrapper around [mkdirp](https://github.com/substack/node-mkdirp) that uses promises.