MCPcopy
hub / github.com/angular/angular / list

Method list

packages/service-worker/cli/filesystem.ts:18–35  ·  view source on GitHub ↗
(_path: string)

Source from the content-addressed store, hash-verified

16 constructor(private base: string) {}
17
18 async list(_path: string): Promise<string[]> {
19 const dir = this.canonical(_path);
20 const entries = fs
21 .readdirSync(dir)
22 .map((entry: string) => ({entry, stats: fs.statSync(path.join(dir, entry))}));
23 const files = entries
24 .filter((entry: any) => !entry.stats.isDirectory())
25 .map((entry: any) => path.posix.join(_path, entry.entry));
26
27 return entries
28 .filter((entry: any) => entry.stats.isDirectory())
29 .map((entry: any) => path.posix.join(_path, entry.entry))
30 .reduce(
31 async (list: Promise<string[]>, subdir: string) =>
32 (await list).concat(await this.list(subdir)),
33 Promise.resolve(files),
34 );
35 }
36
37 async read(_path: string): Promise<string> {
38 const file = this.canonical(_path);

Callers

nothing calls this directly

Calls 7

canonicalMethod · 0.95
mapMethod · 0.80
reduceMethod · 0.80
joinMethod · 0.65
isDirectoryMethod · 0.65
resolveMethod · 0.65
filterMethod · 0.45

Tested by

no test coverage detected