(text, eol)
| 667 | } |
| 668 | |
| 669 | function normalizeEol(text, eol) { |
| 670 | const normalized = String(text || '').replace(/\r\n/g, '\n').replace(/\r/g, '\n') |
| 671 | if (eol === '\r\n') return normalized.replace(/\n/g, '\r\n') |
| 672 | return normalized |
| 673 | } |
| 674 | |
| 675 | function encodeTextBuffer(text, options) { |
| 676 | const encoding = options?.encoding || 'utf8' |