node.js获取目录下的所有文件
const fs=require('fs')
const path=require('path')
function getFiles(dir){
const stat=fs.statSync(dir)
if(stat.isDirectory()){
//判断是不是目录
const dirs=fs.readdirSync(dir)
dirs.forEach(value=>{
// console.log('路径',path.resolve(dir,value));
getFiles(path.join(dir,value))