MCPcopy Create free account
hub / github.com/code-pushup/cli / crawlFileSystemFsWalk

Function crawlFileSystemFsWalk

packages/utils/perf/crawl-file-system/fs-walk.ts:5–27  ·  view source on GitHub ↗
(
  options: CrawlFileSystemOptions<T>,
)

Source from the content-addressed store, hash-verified

3
4// from https://github.com/webpro/knip/pull/426
5export function crawlFileSystemFsWalk<T = string>(
6 options: CrawlFileSystemOptions<T>,
7): Promise<T[]> {
8 const { directory } = options;
9
10 return new Promise((resolve, reject) => {
11 const result: T[] = [];
12 const stream = walkStream(directory);
13
14 stream.on('data', (entry: Entry) => {
15 // eslint-disable-next-line functional/immutable-data
16 result.push(entry.path as T);
17 });
18
19 stream.on('error', error => {
20 reject(error);
21 });
22
23 stream.on('end', () => {
24 resolve(result);
25 });
26 });
27}

Callers

nothing calls this directly

Calls 1

resolveFunction · 0.85

Tested by

no test coverage detected