const fs = require('fs');
const { resolve } = require('path');
//读取文件夹子目录
fs.readdir('qwe',(err,arr) => {
//遍历文件夹里的文件及文件夹
let result = arr.map(item =>{
item = 'qwe/' + item;
return new Promise((resolve,reject) => {
fs.unlink(item,(err) => {
if(err){
reject(err);
return;
}
resolve();
})
})
})
Promise.all(result).then(() =>{
fs.rmdirSync('qwe');
})
})
mty_main_mty
1.0.0 • Public • PublishedReadme
Keywords
nonePackage Sidebar
Install
npm i mty_main_mty
Weekly Downloads
0
Version
1.0.0
License
ISC
Unpacked Size
1.51 kB
Total Files
3