MCPcopy Create free account
hub / github.com/MathMan05/Fermi / crawlDir

Function crawlDir

build.ts:152–172  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

150 await Promise.all((await fs.readdir(curPath)).map((_) => processFile(_)));
151}
152async function crawlDir(dir: string) {
153 const dirs = await fs.readdir(dir);
154 const m = await Promise.all(
155 dirs.map(async (file) => {
156 const idir = path.join(dir, file);
157 const stats = await fs.lstat(idir);
158 if (stats.isDirectory()) {
159 return [file, await crawlDir(idir)] as const;
160 } else {
161 if (file.startsWith(".")) {
162 //Don't show hidden files lol
163 return [file, undefined] as const;
164 }
165 return [file, file] as const;
166 }
167 }),
168 );
169 const obj = {};
170 m.forEach((_) => (obj[_[0]] = _[1]));
171 return obj;
172}
173async function build() {
174 entryPoints = [];
175 console.time("build");

Callers 1

buildFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected