(name: string, body: string)
| 238 | // reads all of it or none, and the last of two writing it wins. Its temp |
| 239 | // file is new, as one already there may link to a file outside the cache |
| 240 | private write(name: string, body: string): void { |
| 241 | const path = join(this.dir, `${name}.json`) |
| 242 | const temp = `${path}.${process.pid}-${threadId}.tmp` |
| 243 | try { |
| 244 | writeFileSync(temp, `${hashOf(body)}\n${body}`, { flag: "wx" }) |
| 245 | renameSync(temp, path) |
| 246 | } catch { |
| 247 | rmSync(temp, { force: true }) |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | export interface SnapshotCheck { |
no test coverage detected