Skip to content

ChunkListBuffer

Defined in: packages/format-core/src/chunk-list-buffer.ts:152

Zero-copy-on-append DecodeBuffer over a chunk list, exposed to decoders as a ByteCursor.

Trades a cheaper append (no copy, unlike ByteAccumulator’s arena) for a costlier per-byte read (a method call and a linear chunk-list search instead of a native Uint8Array index). ByteAccumulator is the better default: a decode buffer holds control data — commands, headers, length prefixes — while declared payloads stream past it, so the copy it pays is bounded by the decoder’s own limits. Reach for this one only when a protocol accumulates a large value outside a declared body.

new ChunkListBuffer(): ChunkListBuffer

ChunkListBuffer

get buffered(): number

Defined in: packages/format-core/src/chunk-list-buffer.ts:157

Unconsumed unit count currently held.

number

Unconsumed unit count currently held.

DecodeBuffer.buffered

append(chunk): void

Defined in: packages/format-core/src/chunk-list-buffer.ts:161

Append chunk, growing or compacting the backing as needed.

Uint8Array

void

DecodeBuffer.append


clear(): void

Defined in: packages/format-core/src/chunk-list-buffer.ts:202

Discard everything held.

void

DecodeBuffer.clear


consume(count): void

Defined in: packages/format-core/src/chunk-list-buffer.ts:177

Drop count units from the front.

number

void

DecodeBuffer.consume


take(): Uint8Array

Defined in: packages/format-core/src/chunk-list-buffer.ts:195

Remove and return the unconsumed units, resetting the buffer.

Uint8Array

DecodeBuffer.take


view(): ByteCursor

Defined in: packages/format-core/src/chunk-list-buffer.ts:169

Window over the unconsumed units. Invalidated by the next append or consume; copy before retaining.

ByteCursor

DecodeBuffer.view