( filePath: string, data: string | NodeJS.ArrayBufferView, )
| 131 | * (no need to re-run icacls on every log line). |
| 132 | */ |
| 133 | export function appendSecureFile( |
| 134 | filePath: string, |
| 135 | data: string | NodeJS.ArrayBufferView, |
| 136 | ): void { |
| 137 | const existed = fs.existsSync(filePath); |
| 138 | fs.appendFileSync(filePath, data, { mode: 0o600 }); |
| 139 | if (!existed) restrictFilePermissions(filePath); |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * `mkdir -p` with owner-only directory permissions, cross-platform. |
no test coverage detected