arnaucube
arnaucube/socketioMEANseedPublic Self-hosted repository
socketioMEANseed/www/node_modules/mkdirp/readme.markdown
www/node_modules/mkdirp/readme.markdownRaw
  1# mkdirp
  2
  3Like `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
 12var mkdirp = require('mkdirp');
 13    
 14mkdirp('/tmp/foo/bar/baz', function (err) {
 15    if (err) console.error(err)
 16    else console.log('pow!')
 17});
 18```
 19
 20Output
 21
 22```
 23pow!
 24```
 25
 26And now /tmp/foo/bar/baz exists, huzzah!
 27
 28# methods
 29
 30```js
 31var mkdirp = require('mkdirp');
 32```
 33
 34## mkdirp(dir, opts, cb)
 35
 36Create a new directory and any necessary subdirectories at `dir` with octal
 37permission string `opts.mode`. If `opts` is a non-object, it will be treated as
 38the `opts.mode`.
 39
 40If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
 41
 42`cb(err, made)` fires with the error or the first directory `made`
 43that had to be created, if any.
 44
 45You can optionally pass in an alternate `fs` implementation by passing in
 46`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and
 47`opts.fs.stat(path, cb)`.
 48
 49## mkdirp.sync(dir, opts)
 50
 51Synchronously create a new directory and any necessary subdirectories at `dir`
 52with octal permission string `opts.mode`. If `opts` is a non-object, it will be
 53treated as the `opts.mode`.
 54
 55If `opts.mode` isn't specified, it defaults to `0777 & (~process.umask())`.
 56
 57Returns the first directory that had to be created, if any.
 58
 59You can optionally pass in an alternate `fs` implementation by passing in
 60`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and
 61`opts.fs.statSync(path)`.
 62
 63# usage
 64
 65This package also ships with a `mkdirp` command.
 66
 67```
 68usage: mkdirp [DIR1,DIR2..] {OPTIONS}
 69
 70  Create each supplied directory including any necessary parent directories that
 71  don't yet exist.
 72  
 73  If the directory already exists, do nothing.
 74
 75OPTIONS are:
 76
 77  -m, --mode   If a directory needs to be created, set the mode as an octal
 78               permission string.
 79
 80```
 81
 82# install
 83
 84With [npm](http://npmjs.org) do:
 85
 86```
 87npm install mkdirp
 88```
 89
 90to get the library, or
 91
 92```
 93npm install -g mkdirp
 94```
 95
 96to get the command.
 97
 98# license
 99
100MIT