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