code: function mkdirSyncRecursive(directory) {
      var path = directory.replace(/\/$/, '').split('/');
      for (var i = 1; i <= path.length; i++) {
          var segment = path.slice(0, i).join('/');
          segment.length > 0 && !fs.existsSync(segment) ? fs.mkdirSync(segment) : null ;
      }
  }
docs: Create directory
  
  @param directory