1 | mkdirp
|
2 | ======
|
3 |
|
4 | Like `mkdir -p`, but in node.js!
|
5 |
|
6 | [![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp)
|
7 |
|
8 | example
|
9 | =======
|
10 |
|
11 | pow.js
|
12 | ------
|
13 | var mkdirp = require('mkdirp');
|
14 |
|
15 | mkdirp('/tmp/foo/bar/baz', function (err) {
|
16 | if (err) console.error(err)
|
17 | else console.log('pow!')
|
18 | });
|
19 |
|
20 | Output
|
21 | pow!
|
22 |
|
23 | And now /tmp/foo/bar/baz exists, huzzah!
|
24 |
|
25 | methods
|
26 | =======
|
27 |
|
28 | var mkdirp = require('mkdirp');
|
29 |
|
30 | mkdirp(dir, mode, cb)
|
31 | ---------------------
|
32 |
|
33 | Create a new directory and any necessary subdirectories at `dir` with octal
|
34 | permission string `mode`.
|
35 |
|
36 | If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
|
37 |
|
38 | `cb(err, made)` fires with the error or the first directory `made`
|
39 | that had to be created, if any.
|
40 |
|
41 | mkdirp.sync(dir, mode)
|
42 | ----------------------
|
43 |
|
44 | Synchronously create a new directory and any necessary subdirectories at `dir`
|
45 | with octal permission string `mode`.
|
46 |
|
47 | If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
|
48 |
|
49 | Returns the first directory that had to be created, if any.
|
50 |
|
51 | install
|
52 | =======
|
53 |
|
54 | With [npm](http://npmjs.org) do:
|
55 |
|
56 | npm install mkdirp
|
57 |
|
58 | license
|
59 | =======
|
60 |
|
61 | MIT/X11
|