var fs = require('fs');
var join = require('path').join;
function getJsonFiles(jsonPath) {
let jsonFiles = [];
function findJsonFile(path) {
let files = fs.readdirSync(path);
files.forEach(function (item, index) {
let fPath = join(path, item);
let stat = fs.statSync(fPath);
if (stat.isDirectory() === true) {
findJsonFile(fPath);
}
if (stat.isFile() === true) {
jsonFiles.push(fPath);
}
});
}
findJsonFile(jsonPath);
console.log(jsonFiles);
}
getJsonFiles("test");
nodejs 현재 아래에있는 모든 파일을 읽을
추천
출처www.cnblogs.com/daysme/p/11231116.html
추천
행