lib/fs.js
function mkdir_p (path, mode, callback, position) {
    var parts = require('path').normalize(path).split(osSep);

    mode = mode || process.umask();
    position = position || 0;
  
    if (position >= parts.length) {
      return callback();
    }
  
    var directory = parts.slice(0, position + 1).join(osSep) || osSep;
    fs.stat(directory, function(err) {    
      if (err === null) {
        mkdir_p(path, mode, callback, position + 1);
      } else {
        mkdirOrig(directory, mode, function (err) {
          if (err && err.code != 'EEXIST') {
            return callback(err);
          } else {
            mkdir_p(path, mode, callback, position + 1);
          }
        });
      }
    });
  }
function mkdir_p (path, mode, callback, position) {
    var parts = require('path').normalize(path).split(osSep);

    mode = mode || process.umask();
    position = position || 0;
  
    if (position >= parts.length) {
      return callback();
    }
  
    var directory = parts.slice(0, position + 1).join(osSep) || osSep;
    fs.stat(directory, function(err) {    
      if (err === null) {
        mkdir_p(path, mode, callback, position + 1);
      } else {
        mkdirOrig(directory, mode, function (err) {
          if (err && err.code != 'EEXIST') {
            return callback(err);
          } else {
            mkdir_p(path, mode, callback, position + 1);
          }
        });
      }
    });
  }
function mkdir_p ( path , mode , callback , position ) { var parts = require ( 'path' ) . normalize ( path ) . split ( osSep ) ; mode = mode || process . umask ( ) ; position = position || 0 ; if ( position >= parts . length ) { return callback ( ) ; } var directory = parts . slice ( 0 , position + 1 ) . join ( osSep ) || osSep ; fs . stat ( directory , function ( err ) { if ( err === null ) { mkdir_p ( path , mode , callback , position + 1 ) ; } else { mkdirOrig ( directory , mode , function ( err ) { if ( err && err . code != 'EEXIST' ) { return callback ( err ) ; } else { mkdir_p ( path , mode , callback , position + 1 ) ; } } ) ; } } ) ; }
Offers functionality similar to mkdir -p

Asynchronous operation. No arguments other than a possible exception
are given to the completion callback.
Offers functionality similar to mkdir - p