nodejs 지정 한 경로 의 모든 폴 더 이름 가 져 오기

687 단어
예제: 가 져 오기. / coponents 의 모든 폴 더 이름
let components = []
const files = fs.readdirSync('./components')
files.forEach(function (item, index) {
    let stat = fs.lstatSync("./components/" + item)
    if (stat.isDirectory() === true) { 
      components.push(item)
    }
})

console.log(components);

 
다음으로 전송:https://www.cnblogs.com/CyLee/p/8430251.html

좋은 웹페이지 즐겨찾기