MCPcopy Create free account
hub / github.com/SethGammon/Citadel / countFiles

Function countFiles

scripts/unharness.js:115–126  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

113 if (!fs.existsSync(dir)) return false;
114 fs.rmSync(dir, { recursive: true, force: true });
115 return true;
116}
117
118function countFiles(dir) {
119 if (!fs.existsSync(dir)) return 0;
120 let count = 0;
121 function walk(d) {
122 for (const entry of fs.readdirSync(d, { withFileTypes: true })) {
123 if (entry.isDirectory()) walk(path.join(d, entry.name));
124 else count++;
125 }
126 }
127 walk(dir);
128 return count;
129}

Callers 1

mainFunction · 0.70

Calls 1

walkFunction · 0.70

Tested by

no test coverage detected