MCPcopy Create free account
hub / github.com/backnotprop/plannotator / readSourceFileSnapshot

Function readSourceFileSnapshot

packages/shared/source-save-node.ts:59–70  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

57}
58
59export function readSourceFileSnapshot(filePath: string): SourceFileSnapshot {
60 const bytes = readFileSync(filePath);
61 const stat = statSync(filePath);
62 const text = bytes.toString("utf8");
63 return {
64 text,
65 hash: hashSourceBytes(bytes),
66 mtimeMs: stat.mtimeMs,
67 size: stat.size,
68 eol: detectSourceEol(text),
69 };
70}
71
72export function sourceFileSnapshotFromText(text: string): SourceFileSnapshot {
73 const bytes = Buffer.from(text, "utf8");

Callers 7

handleDocFunction · 0.90
getPrimarySourceFunction · 0.90
saveSourceFileAtomicFunction · 0.85
getPrimarySourceFunction · 0.85
handleDocRequestFunction · 0.85

Calls 3

hashSourceBytesFunction · 0.85
detectSourceEolFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected