Decode buf[0..len) to utf8, normalizing CRLF only if CR is present.
(buf: Buffer, len: number)
| 158 | |
| 159 | /** Decode buf[0..len) to utf8, normalizing CRLF only if CR is present. */ |
| 160 | function normalizeCRLF(buf: Buffer, len: number): string { |
| 161 | const s = buf.toString('utf8', 0, len) |
| 162 | return s.includes('\r') ? s.replaceAll('\r\n', '\n') : s |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Given an absolute match offset, read ±contextLines around it and return |
no test coverage detected