| 356 | let afterCR = false |
| 357 | |
| 358 | const takeLine = (chunk: Uint8Array, start: number, end: number): Uint8Array => { |
| 359 | if (pendingBytes === 0) return chunk.subarray(start, end) |
| 360 | const line = new Uint8Array(pendingBytes + end - start) |
| 361 | let offset = 0 |
| 362 | for (const bytes of pending) { |
| 363 | line.set(bytes, offset) |
| 364 | offset += bytes.length |
| 365 | } |
| 366 | line.set(chunk.subarray(start, end), offset) |
| 367 | pending = [] |
| 368 | pendingBytes = 0 |
| 369 | return line |
| 370 | } |
| 371 | |
| 372 | const decodeLine = (bytes: Uint8Array, out: Array<unknown>, unterminated: boolean) => { |
| 373 | let line: string |