MCPcopy Index your code
hub / github.com/angular/angular / checkFilesInDirectory

Function checkFilesInDirectory

adev/shared-docs/utils/filesystem.utils.ts:41–65  ·  view source on GitHub ↗
(
  dir: string,
  fs: FileSystemAPI,
  filterFromRootPredicate: ((path: string) => boolean) | null,
  files: FileAndContent[] = [],
)

Source from the content-addressed store, hash-verified

39}
40
41export const checkFilesInDirectory = async (
42 dir: string,
43 fs: FileSystemAPI,
44 filterFromRootPredicate: ((path: string) => boolean) | null,
45 files: FileAndContent[] = [],
46) => {
47 const entries = (await fs.readdir(dir, {withFileTypes: true})) ?? [];
48
49 for (const entry of entries) {
50 const fullPath = normalizePath(`${dir}/${entry.name}`);
51
52 if (filterFromRootPredicate && !filterFromRootPredicate?.(entry.name)) {
53 continue;
54 }
55
56 if (entry.isFile()) {
57 const content = await fs.readFile(fullPath, 'utf-8');
58 files.push({content, path: fullPath});
59 } else if (entry.isDirectory()) {
60 await checkFilesInDirectory(fullPath, fs, null, files);
61 }
62 }
63
64 return files;
65};

Callers 1

getSolutionFilesMethod · 0.90

Calls 6

normalizePathFunction · 0.90
readdirMethod · 0.65
isFileMethod · 0.65
readFileMethod · 0.65
isDirectoryMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…