async function printFiles () {
const files = await getFilePaths();
await Promise.all(files.map(async (file) => {
const contents = await fs.readFile(file, 'utf8')
console.log(contents)
}));
}
async function dbFuc(db) {
let docs = [{}, {}, {}];
for (let doc of docs) {
await db.post(doc);
}
}
let a = [1, 2, 34, 56]
function aa(val) {
return new Promise((resolve) => {
setTimeout(function () {
console.log(val)
resolve('done')
}, 2000)
})
}
(async function () {
for (value of a) {
await aa(value)
}
})()
作者
admin
发表于
2020-04-24 19:04:00
,最后修改于
2020-04-24 19:07:54
Comments