code: function createDir(dir) {
    const splitPath = dir.split('/');
    splitPath.reduce((path, subPath) => {
      let currentPath;
      if(subPath != '.'){
        currentPath = path + '/' + subPath;
        if (!fs.existsSync(currentPath)){
          fs.mkdirSync(currentPath);
        }
      }
      else{
        currentPath = subPath;
      }
      return currentPath
    }, '')
  }
docs: recursive directory creation