MCPcopy
hub / github.com/QwikDev/qwik / scanFiles

Function scanFiles

scripts/docs_sync/util.ts:5–27  ·  view source on GitHub ↗
(
  dir: string,
  callback: (file: string) => Promise<void>
)

Source from the content-addressed store, hash-verified

3import { join } from 'node:path';
4
5export async function scanFiles(
6 dir: string,
7 callback: (file: string) => Promise<void>
8): Promise<void> {
9 const promises: Promise<void>[] = [];
10 readdir(dir, (err, files) => {
11 if (err) return;
12 files.forEach((file) => {
13 const path = join(dir, file);
14 if (file === 'node_modules') return;
15 if (file.startsWith('.')) return;
16 stat(path, (err, status) => {
17 if (err) return;
18 if (status.isDirectory()) {
19 promises.push(scanFiles(path, callback));
20 } else if (status.isFile()) {
21 promises.push(callback(path));
22 }
23 });
24 });
25 });
26 await Promise.all(promises);
27}
28
29const hackMdCache = new Map<string, Promise<string[]>>();
30

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls 2

joinFunction · 0.85
callbackFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…