You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.2 KiB

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