( filePath: string, content: string, encoding: BufferEncoding, endings: LineEndingType, )
| 82 | } |
| 83 | |
| 84 | export function writeTextContent( |
| 85 | filePath: string, |
| 86 | content: string, |
| 87 | encoding: BufferEncoding, |
| 88 | endings: LineEndingType, |
| 89 | ): void { |
| 90 | let toWrite = content |
| 91 | if (endings === 'CRLF') { |
| 92 | // Normalize any existing CRLF to LF first so a new_string that already |
| 93 | // contains \r\n (raw model output) doesn't become \r\r\n after the join. |
| 94 | toWrite = content.replaceAll('\r\n', '\n').split('\n').join('\r\n') |
| 95 | } |
| 96 | |
| 97 | writeFileSyncAndFlush_DEPRECATED(filePath, toWrite, { encoding }) |
| 98 | } |
| 99 | |
| 100 | export function detectFileEncoding(filePath: string): BufferEncoding { |
| 101 | try { |
no test coverage detected