mkdirp-promise
Promise version of mkdirp:
Like mkdir -p, but in node.js!
Install
npm install --production --save mkdirp-promise
Usage
I recommend using an optimized build matching your Node.js environment version, otherwise, the standard require
would work just fine with any version of Node >= v4.0
.
const mkdirp = require('mkdirp-promise/lib/node7')
const mkdirp = require('mkdirp-promise/lib/node6')
var mkdirp = require('mkdirp-promise/lib/node5')
var mkdirp = require('mkdirp-promise')
API
const mkdirp = require('mkdirp-promise')
mkdirp(dir, [, options])
pattern: String
options: Object
or String
Return: Object
(Promise)
When it finishes, it will be fulfilled with the first directory made that had to be created, if any.
When it fails, it will be rejected with an error as its first argument.
mkdirp('/tmp/foo/bar/baz')
.then(console.log)
.catch(console.error)
options
The option object will be directly passed to mkdirp.
:copyright: www.ahmadnassri.com ·
License: ISC ·
Github: @ahmadnassri ·
Twitter: @ahmadnassri