diff options
author | isaacs <i@izs.me> | 2012-01-13 20:33:27 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-01-13 20:41:06 +0400 |
commit | c18fe966ddbeb66c8a9b9aa8ab4899166e6986f5 (patch) | |
tree | 8650e7575caff9d05e04352b78669dd81d21230d /node_modules/mkdirp | |
parent | b7ff884870958221eb52c5a600c101fab4c26781 (diff) |
check in node_modules
Diffstat (limited to 'node_modules/mkdirp')
-rw-r--r-- | node_modules/mkdirp/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/mkdirp/README.markdown | 21 | ||||
-rw-r--r-- | node_modules/mkdirp/index.js | 36 | ||||
-rw-r--r-- | node_modules/mkdirp/package.json | 23 |
4 files changed, 101 insertions, 0 deletions
diff --git a/node_modules/mkdirp/LICENSE b/node_modules/mkdirp/LICENSE new file mode 100644 index 000000000..432d1aeb0 --- /dev/null +++ b/node_modules/mkdirp/LICENSE @@ -0,0 +1,21 @@ +Copyright 2010 James Halliday (mail@substack.net) + +This project is free software released under the MIT/X11 license: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/mkdirp/README.markdown b/node_modules/mkdirp/README.markdown new file mode 100644 index 000000000..0393c4ea5 --- /dev/null +++ b/node_modules/mkdirp/README.markdown @@ -0,0 +1,21 @@ +mkdirp +====== + +Like `mkdir -p`, but in node.js! + +Example +======= + +pow.js +------ + var mkdirp = require('mkdirp'); + + mkdirp('/tmp/foo/bar/baz', 0755, function (err) { + if (err) console.error(err) + else console.log('pow!') + }); + +Output + pow! + +And now /tmp/foo/bar/baz exists, huzzah! diff --git a/node_modules/mkdirp/index.js b/node_modules/mkdirp/index.js new file mode 100644 index 000000000..660280146 --- /dev/null +++ b/node_modules/mkdirp/index.js @@ -0,0 +1,36 @@ +var path = require('path'); +var fs = require('fs'); + +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + +function mkdirP (p, mode, f) { + var cb = f || function () {}; + if (typeof mode === 'string') mode = parseInt(mode, 8); + p = path.resolve(p); + + fs.mkdir(p, mode, function (er) { + if (!er) return cb(); + switch (er.code) { + case 'ENOENT': + mkdirP(path.dirname(p), mode, function (er) { + if (er) cb(er); + else mkdirP(p, mode, cb); + }); + break; + + case 'EEXIST': + fs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original EEXIST be the failure reason. + if (er2 || !stat.isDirectory()) cb(er) + else if ((stat.mode & 0777) !== mode) fs.chmod(p, mode, cb); + else cb(); + }); + break; + + default: + cb(er); + break; + } + }); +} diff --git a/node_modules/mkdirp/package.json b/node_modules/mkdirp/package.json new file mode 100644 index 000000000..99149f747 --- /dev/null +++ b/node_modules/mkdirp/package.json @@ -0,0 +1,23 @@ +{ + "name" : "mkdirp", + "description" : "Recursively mkdir, like `mkdir -p`", + "version" : "0.1.0", + "author" : "James Halliday <mail@substack.net> (http://substack.net)", + "main" : "./index", + "keywords" : [ + "mkdir", + "directory" + ], + "repository" : { + "type" : "git", + "url" : "http://github.com/substack/node-mkdirp.git" + }, + "scripts" : { + "test" : "tap test/*.js" + }, + "devDependencies" : { + "tap" : "0.0.x" + }, + "license" : "MIT/X11", + "engines": { "node": "*" } +} |