(chunk: Buffer)
| 67 | } |
| 68 | |
| 69 | private pushTail(chunk: Buffer): void { |
| 70 | this.tail.push(chunk); |
| 71 | this.tailBytes += chunk.length; |
| 72 | while (this.tailBytes > this.tailCap && this.tail.length > 0) { |
| 73 | const first = this.tail[0]!; |
| 74 | const excess = this.tailBytes - this.tailCap; |
| 75 | if (excess >= first.length) { |
| 76 | this.tail.shift(); |
| 77 | this.tailBytes -= first.length; |
| 78 | } else { |
| 79 | this.tail[0] = first.subarray(excess); |
| 80 | this.tailBytes -= excess; |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | finalize(label: string): { |
| 86 | content: string; |