MCPcopy Create free account
hub / github.com/T-Lab-CUHKSZ/claude-code / readJsonSafe

Function readJsonSafe

config-ui/server.ts:65–71  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

63// --- File I/O Helpers ---
64
65function readJsonSafe(path: string): any {
66 try {
67 return JSON.parse(readFileSync(path, 'utf-8'))
68 } catch {
69 return {}
70 }
71}
72
73function writeJsonSafe(path: string, data: any) {
74 const dir = dirname(path)

Callers 1

handleAPIFunction · 0.85

Calls 1

readFileSyncFunction · 0.90

Tested by

no test coverage detected