let fs = require('fs')

// Create folders synchronously
// function mkdirp(paths){
// let arr = paths.split('/')
// for (let i = 0; i < arr.length; i++) {
// let currentPath = arr.slice(0,i+1).join('/')
// if(! fs.existsSync(currentPath)){
// fs.mkdirSync(currentPath)
/ /}
/ /}
// }


// Create a directory asynchronously
// function mkdirp(paths,cb){
// let arr = paths.split('/')
// let index = 0
// function next(){
// if(index === arr.length) return cb()
// let currentPath = arr.slice(0,++index).join('/')
            //fs.access() checks whether the directory exists
// fs.access(currentPath,(err) => {
// if(err){
// fs.mkdir(currentPath,next)
// }else{
// next()
/ /}
/ /})
/ /}
// next()
// }





Copy the code