openHacking/xhack

mkdir in nodejs

Opened this issue · 0 comments

/**
 * @example
 * mkdir('script',()=>{})
 * 
 * @param dir 
 * @param cb 
 */
function mkdir(dir,cb){
    fs.mkdir(path.join(__dirname, dir), (err) => {
        if (err) {
            return console.error(err);
        }
        console.log(`Successfully create ${dir}!`);

        cb && cb()
    });
}