index.js
function (path) {
    var pathSep = require('path').sep;
    var dirs = path.split(pathSep);
    var root = '';

    while (dirs.length > 0) {
      var dir = dirs.shift();
      if (dir === '') {
        root = pathSep;
      }
      if (!fs.existsSync(root + dir)) {
        fs.mkdirSync(root + dir);
      }
      root += dir + pathSep;
    }
  }
function (path) {
    var pathSep = require('path').sep;
    var dirs = path.split(pathSep);
    var root = '';

    while (dirs.length > 0) {
      var dir = dirs.shift();
      if (dir === '') {
        root = pathSep;
      }
      if (!fs.existsSync(root + dir)) {
        fs.mkdirSync(root + dir);
      }
      root += dir + pathSep;
    }
  }
function ( path ) { var pathSep = require ( 'path' ) . sep ; var dirs = path . split ( pathSep ) ; var root = '' ; while ( dirs . length > 0 ) { var dir = dirs . shift ( ) ; if ( dir === '' ) { root = pathSep ; } if ( ! fs . existsSync ( root + dir ) ) { fs . mkdirSync ( root + dir ) ; } root += dir + pathSep ; } }
Helper method to generate deeper nested directory structures

@method _recursiveMakeDirSync
@param {string} path PAth to create
Helper method to generate deeper nested directory structures