MCPcopy Create free account
hub / github.com/SethGammon/Citadel / loadState

Function loadState

scripts/telemetry-otlp-export.js:256–266  ·  view source on GitHub ↗
(stateFile)

Source from the content-addressed store, hash-verified

254}
255
256function loadState(stateFile) {
257 try {
258 const parsed = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
259 if (parsed && typeof parsed === 'object' && parsed.offsets && typeof parsed.offsets === 'object') {
260 return { version: 1, offsets: parsed.offsets };
261 }
262 } catch (error) {
263 // Missing or corrupt state file: start from the beginning of each file.
264 }
265 return { version: 1, offsets: {} };
266}
267
268function saveState(stateFile, state) {
269 fs.mkdirSync(path.dirname(stateFile), { recursive: true });

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected