* Write file only if content has changed.
(filePath: string, content: string)
| 69 | * Write file only if content has changed. |
| 70 | */ |
| 71 | function writeFileSafe(filePath: string, content: string): void { |
| 72 | try { |
| 73 | const current = readFileSync(filePath, 'utf-8'); |
| 74 | if (current === content) { |
| 75 | return; |
| 76 | } |
| 77 | } catch { |
| 78 | // Ignore missing or unreadable file |
| 79 | } |
| 80 | writeFileSync(filePath, content, 'utf-8'); |
| 81 | } |
no outgoing calls
no test coverage detected