(filePath: string)
| 269 | } |
| 270 | |
| 271 | function readJsonObject(filePath: string): Record<string, unknown> | null { |
| 272 | try { |
| 273 | const raw = JSON.parse(fs.readFileSync(filePath, 'utf8')); |
| 274 | return isRecord(raw) ? raw : null; |
| 275 | } catch { |
| 276 | return null; |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | async function writeJsonAtomic(filePath: string, value: Record<string, unknown>): Promise<void> { |
| 281 | const directory = path.dirname(filePath); |
no test coverage detected