(targetPath: string, content: Buffer, mode?: number)
| 23 | } |
| 24 | |
| 25 | function writeAtomically(targetPath: string, content: Buffer, mode?: number): void { |
| 26 | mkdirSync(dirname(targetPath), { recursive: true }) |
| 27 | const temporaryPath = `${targetPath}.tmp.${process.pid}` |
| 28 | writeFileSync(temporaryPath, content) |
| 29 | if (mode !== undefined) { |
| 30 | chmodSync(temporaryPath, mode) |
| 31 | } |
| 32 | renameSync(temporaryPath, targetPath) |
| 33 | } |
| 34 | |
| 35 | function sanitizeGroupKey(groupKey: string): string { |
| 36 | return groupKey.replace(/[^a-zA-Z0-9._-]+/g, '-') |
no test coverage detected