MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / walkDir

Function walkDir

src/directory.ts:1077–1094  ·  view source on GitHub ↗
(dir: string, prefix: string = '')

Source from the content-addressed store, hash-verified

1075 const files: string[] = [];
1076
1077 function walkDir(dir: string, prefix: string = ''): void {
1078 const entries = fs.readdirSync(dir, { withFileTypes: true });
1079
1080 for (const entry of entries) {
1081 const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
1082
1083 // Skip symlinks to prevent following links outside .codegraph
1084 if (entry.isSymbolicLink()) {
1085 continue;
1086 }
1087
1088 if (entry.isDirectory()) {
1089 walkDir(path.join(dir, entry.name), relativePath);
1090 } else {
1091 files.push(relativePath);
1092 }
1093 }
1094 }
1095
1096 walkDir(codegraphDir);
1097 return files;

Callers 2

listDirectoryContentsFunction · 0.85
getDirectorySizeFunction · 0.85

Calls 2

pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected