fs.readdir()返回文件名和子目录名称的数组,或 fs.Dirents[].
fs.Dirents[]
我无法让它发挥作用.这是一个简单的例子:
console.log(require("fs").readdirSync("/",{withFileTypes:true}));
这给了我一个字符串数组(例如[“bin”,“mnt”,“usr”,“var”,…]),而不是fs.Dirent对象的数组(这就是我想要的).
我如何让它工作?