Node.js 計算目錄內檔案數量 2017-02-16 | No Comments 可以用 fs 或者 shelljs 來做,各有千秋 //using fs fs = require('fs'); console.log((fs.readdirSync('../json/')).length); //using shelljs shell = require('shelljs'); console.log((shell.ls('../json/')).length); Share this: Share on X (Opens in new window) X Share on Facebook (Opens in new window) Facebook Share on Pinterest (Opens in new window) Pinterest 學習工作, 工作, 程式 | Tags: javascript, nodejs