Skip to content

@euforic /mkdirp.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
function mkdirP (p, fn, made) {
if (!made) made = null;
var cb = fn || function () {};
p = path.resolve(p);
fs.mkdir(p, function (err) {
if (!err) return cb(null, made || p);
if (err.code != 'ENOENT') return err;
mkdirP(path.dirname(p), mode, function (err, made) {
if (err) cb(err, made);
return mkdirP(p, cb, made);
});
});
}
/**
* usage
*/
mkdirP('/Users/euforic/test_cases/mkdirP', function(){
console.log(fs.existsSync('/Users/euforic/test_cases/mkdirP'));
});
@euforic
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.