MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / getAllFiles

Function getAllFiles

lib/cache/on-disk.ts:39–47  ·  view source on GitHub ↗
(root: string, dir?: string)

Source from the content-addressed store, hash-verified

37type relFile = {name: string; fullPath: string};
38
39function getAllFiles(root: string, dir?: string): Array<relFile> {
40 const actualDir = dir || root;
41 return fs.readdirSync(actualDir).reduce((files: Array<relFile>, file: string) => {
42 const fullPath = path.join(actualDir, file);
43 const name = path.relative(root, fullPath);
44 const isDirectory = fs.statSync(fullPath).isDirectory();
45 return isDirectory ? [...files, ...getAllFiles(root, fullPath)] : [...files, {name, fullPath}];
46 }, []);
47}
48
49type CacheEntry = {path: string; size: number};
50

Callers 1

constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected