3 Like `mkdir -p`, but in node.js!
5 [![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
12 var mkdirp = require('mkdirp');
14 mkdirp('/tmp/foo/bar/baz', function (err) {
15 if (err) console.error(err)
16 else console.log('pow!')
26 And now /tmp/foo/bar/baz exists, huzzah!
31 var mkdirp = require('mkdirp');
34 ## mkdirp(dir, mode, cb)
36 Create a new directory and any necessary subdirectories at `dir` with octal
37 permission string `mode`.
39 If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
41 `cb(err, made)` fires with the error or the first directory `made`
42 that had to be created, if any.
44 ## mkdirp.sync(dir, mode)
46 Synchronously create a new directory and any necessary subdirectories at `dir`
47 with octal permission string `mode`.
49 If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
51 Returns the first directory that had to be created, if any.
55 With [npm](http://npmjs.org) do: