Gunakan menunggu untuk masing -masing
files.forEach(async (file) => {
const contents = await fs.readFile(file, 'utf8')
})
Hurt Hamster
files.forEach(async (file) => {
const contents = await fs.readFile(file, 'utf8')
})
Array.prototype.forEachAsync = async function (fn) {
for (let t of this) { await fn(t) }
}
Array.prototype.forEachAsyncParallel = async function (fn) {
await Promise.all(this.map(fn));
}