UNPKG

1.19 kBMarkdownView Raw
1mkdirp
2======
3
4Like `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
8example
9=======
10
11pow.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
20Output
21 pow!
22
23And now /tmp/foo/bar/baz exists, huzzah!
24
25methods
26=======
27
28var mkdirp = require('mkdirp');
29
30mkdirp(dir, mode, cb)
31---------------------
32
33Create a new directory and any necessary subdirectories at `dir` with octal
34permission string `mode`.
35
36If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
37
38`cb(err, made)` fires with the error or the first directory `made`
39that had to be created, if any.
40
41mkdirp.sync(dir, mode)
42----------------------
43
44Synchronously create a new directory and any necessary subdirectories at `dir`
45with octal permission string `mode`.
46
47If `mode` isn't specified, it defaults to `0777 & (~process.umask())`.
48
49Returns the first directory that had to be created, if any.
50
51install
52=======
53
54With [npm](http://npmjs.org) do:
55
56 npm install mkdirp
57
58license
59=======
60
61MIT/X11