lib/makedir.js
function makedir(p,mode,next){
    if (typeof mode === 'function' || mode === undefined) {
        next = mode;
        mode = 0777 & (~process.umask());
    }
    if (typeof mode === 'string') mode = parseInt(mode, 8);
    p = path.resolve(p);
    // recursively make sure that directory exists.
    //

    var parent = path.dirname(p);
    if(parent){
        fs.exists(p,handleStatforPath(p,mode,parent,next));
    }else{
        // following convention, if the path is actually a dot at this
        // point, prepend the current process root dir and carry on
        // back up the stack.
        //
        if(p === '.'){
            // replace . with rootdir
            p = rootdir;
            // recurse back up with that value
            return next(null,p)
        }

        //
        // not sure what is up.  path.dirname should create '.' for
        // parent of relative path names
        //
        console.log('in make parent dir, no parents left for : '+p+' try prepending the process root dir');
        throw new Error('parent failure ' + p);
    }
    return null;
}
function makedir(p,mode,next){
    if (typeof mode === 'function' || mode === undefined) {
        next = mode;
        mode = 0777 & (~process.umask());
    }
    if (typeof mode === 'string') mode = parseInt(mode, 8);
    p = path.resolve(p);
    // recursively make sure that directory exists.
    //

    var parent = path.dirname(p);
    if(parent){
        fs.exists(p,handleStatforPath(p,mode,parent,next));
    }else{
        // following convention, if the path is actually a dot at this
        // point, prepend the current process root dir and carry on
        // back up the stack.
        //
        if(p === '.'){
            // replace . with rootdir
            p = rootdir;
            // recurse back up with that value
            return next(null,p)
        }

        //
        // not sure what is up.  path.dirname should create '.' for
        // parent of relative path names
        //
        console.log('in make parent dir, no parents left for : '+p+' try prepending the process root dir');
        throw new Error('parent failure ' + p);
    }
    return null;
}
function makedir ( p , mode , next ) { if ( typeof mode === 'function' || mode === undefined ) { next = mode ; mode = 0777 & ( ~ process . umask ( ) ) ; } if ( typeof mode === 'string' ) mode = parseInt ( mode , 8 ) ; p = path . resolve ( p ) ; // recursively make sure that directory exists. // var parent = path . dirname ( p ) ; if ( parent ) { fs . exists ( p , handleStatforPath ( p , mode , parent , next ) ) ; } else { // following convention, if the path is actually a dot at this // point, prepend the current process root dir and carry on // back up the stack. // if ( p === '.' ) { // replace . with rootdir p = rootdir ; // recurse back up with that value return next ( null , p ) } // // not sure what is up.  path.dirname should create '.' for // parent of relative path names // console . log ( 'in make parent dir, no parents left for : ' + p + ' try prepending the process root dir' ) ; throw new Error ( 'parent failure ' + p ) ; } return null ; }
the function that gets exported, but doesn't actually do any directory making checks if a directory parent exists using stat.  If not, recurs into parent.
the function that gets exported but doesn t actually do any directory making checks if a directory parent exists using stat . If not recurs into parent .