MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / walk

Function walk

apps/api/src/templates/email/preview.ts:302–318  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

300 const map = new Map<string, string>();
301
302 const walk = (dir: string): void => {
303 if (!fs.existsSync(dir)) {
304 return;
305 }
306
307 for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
308 const abs = path.join(dir, entry.name);
309
310 if (entry.isDirectory()) {
311 walk(abs);
312 } else if (entry.isFile()) {
313 const rel = path.relative(PREVIEW_DIR, abs).split(path.sep).join("/");
314
315 map.set(`/${rel}`, abs);
316 }
317 }
318 };
319
320 walk(PREVIEW_DIR);
321

Callers 1

collectServableFilesFunction · 0.70

Calls 1

setMethod · 0.45

Tested by

no test coverage detected