Node 中如何判断一个路径是文件还是文件夹
Issue 欢迎在 Gtihub Issue 中回答此问题: Issue 205 (opens in a new tab)
Author 回答者: PlutoCA (opens in a new tab)
const statInfo = fs.lstatSync("./xx"). statInfo.isDirectory()
Author 回答者: hsq777 (opens in a new tab)
- isFile():检测是否为常规文件
- isDirectory():检测是否为文件夹