Node.js 計算目錄內檔案數量
//using fs
fs = require('fs');
console.log((fs.readdirSync('../json/')).length);
//using shelljs
shell = require('shelljs');
console.log((shell.ls('../json/')).length);
Original link: Phanix's Blog
//using fs
fs = require('fs');
console.log((fs.readdirSync('../json/')).length);
//using shelljs
shell = require('shelljs');
console.log((shell.ls('../json/')).length);
Original link: Phanix's Blog