cara membaca file temp di windowsnodeJs
async function getFiles(dir) {
const dirents = await fs.readdir(dir, { withFileTypes: true })
console.log(dirents)
const files = await Promise.all(
dirents.map((dirent) => {
const res = path.resolve(dir, dirent.name)
return dirent.isDirectory() ? getFiles(res) : res
})
)
return Array.prototype.concat(...files)
}
Restu Wahyu Saputra