(filePath: string, state: UpdateState)
| 149 | |
| 150 | /** Atomic write via tmp-then-rename. Creates parent directories as needed. */ |
| 151 | export const saveState = async (filePath: string, state: UpdateState): Promise<void> => { |
| 152 | await fs.mkdir(path.dirname(filePath), {recursive: true}); |
| 153 | const tmp = `${filePath}.tmp`; |
| 154 | await fs.writeFile(tmp, JSON.stringify(state, null, 2)); |
| 155 | await fs.rename(tmp, filePath); |
| 156 | }; |
no outgoing calls
no test coverage detected