MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / readDirectorySnapshot

Function readDirectorySnapshot

projects/runtime-node/src/fsWatch.ts:27–37  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

25}
26
27function readDirectorySnapshot(dir: string): Map<string, number> {
28 const snapshot = new Map<string, number>()
29 for (const name of fs.readdirSync(dir)) {
30 try {
31 snapshot.set(name, fs.statSync(`${dir}/${name}`).mtimeMs)
32 } catch {
33 // File changed between readdir and stat; the next poll will see the stable state.
34 }
35 }
36 return snapshot
37}
38
39function emitWatchEvent(server: RuntimeServer, watchId: string, dir: string, eventType: string, filename?: string): void {
40 server.supervisor.touchByOwner("fs-watch", watchId)

Callers 1

Calls 1

setMethod · 0.65

Tested by

no test coverage detected