const fs = require('fs');
module.exports = async function mkdir(filePath) {
    console.log(filePath);
    if (await fs.existsSync(filePath)) {
        console.log('该路径已存在');
    }else{
        console.log('该路径不存在');
        const dirCache={};
        filePath=filePath.replace(/\\/g,"/");
        console.log(filePath);
        const arr=filePath.split('/');
        let dir=arr[0];
        for(let i=1;i<arr.length;i++){
            if(!dirCache[dir]&&!fs.existsSync(dir)){
                dirCache[dir]=true;
                await fs.mkdirSync(dir);
            }
            dir=dir+'/'+arr[i];
        }
    }
}