index.js
function mkdirSyncRecursive(root, chunks, mode) {

  var chunk = chunks.shift();
  if (!chunk) {
    return;
  }
  var root = path.join(root, chunk);

  if (fs.existsSync(root) === true) { // already done
    return mkdirSyncRecursive(root, chunks, mode);
  }
  var err = fs.mkdirSync(root, mode);
  return err ? err : mkdirSyncRecursive(root, chunks, mode); // let's magic
}
function mkdirSyncRecursive(root, chunks, mode) {

  var chunk = chunks.shift();
  if (!chunk) {
    return;
  }
  var root = path.join(root, chunk);

  if (fs.existsSync(root) === true) { // already done
    return mkdirSyncRecursive(root, chunks, mode);
  }
  var err = fs.mkdirSync(root, mode);
  return err ? err : mkdirSyncRecursive(root, chunks, mode); // let's magic
}
function mkdirSyncRecursive ( root , chunks , mode ) { var chunk = chunks . shift ( ) ; if ( ! chunk ) { return ; } var root = path . join ( root , chunk ) ; if ( fs . existsSync ( root ) === true ) { // already done return mkdirSyncRecursive ( root , chunks , mode ) ; } var err = fs . mkdirSync ( root , mode ) ; return err ? err : mkdirSyncRecursive ( root , chunks , mode ) ; // let's magic }
make directory recursively. Sync version

@function mkdirSyncRecursive
@param {String} root - absolute root where append chunks
@param {Array} chunks - directories chunks
@param {Number} mode - directories mode, see Node documentation
@return [{Object}]
make directory recursively . Sync version