MCPcopy Create free account
hub / github.com/backnotprop/plannotator / walkFileBrowserFiles

Function walkFileBrowserFiles

packages/server/reference-handlers.ts:551–570  ·  view source on GitHub ↗
(dir: string, root: string, files: Set<string>)

Source from the content-addressed store, hash-verified

549}
550
551async function walkFileBrowserFiles(dir: string, root: string, files: Set<string>): Promise<void> {
552 let entries;
553 try {
554 entries = await readdir(dir, { withFileTypes: true });
555 } catch {
556 return;
557 }
558
559 for (const entry of entries) {
560 const fullPath = join(dir, entry.name);
561 const relativePath = relative(root, fullPath).replace(/\\/g, "/");
562 if (entry.isDirectory()) {
563 if (isFileBrowserExcludedPath(relativePath)) continue;
564 await walkFileBrowserFiles(fullPath, root, files);
565 } else if (entry.isFile() && FILE_BROWSER_EXTENSIONS.test(entry.name)) {
566 if (isFileBrowserExcludedPath(relativePath)) continue;
567 files.add(relativePath);
568 }
569 }
570}
571
572/** List markdown files in a directory as a nested tree. */
573export async function handleFileBrowserFiles(req: Request): Promise<Response> {

Callers 1

handleFileBrowserFilesFunction · 0.85

Calls 3

replaceMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected