(filePath: string, value: unknown)
| 63 | } |
| 64 | |
| 65 | async function writeJsonAtomic(filePath: string, value: unknown): Promise<void> { |
| 66 | await enqueueWrite(async () => { |
| 67 | await ensureParentDirectory(filePath); |
| 68 | const tempPath = `${filePath}.${crypto.randomUUID()}.tmp`; |
| 69 | await writeFile(tempPath, `${JSON.stringify(value, null, 2)}\n`, "utf8"); |
| 70 | await rename(tempPath, filePath); |
| 71 | }); |
| 72 | } |
| 73 | |
| 74 | async function appendLine(filePath: string, line: string): Promise<void> { |
| 75 | await enqueueWrite(async () => { |
no test coverage detected