Skip to content

CborItemDecoder

Defined in: packages/format-cbor/src/binary/decoder.ts:270

Adapts decodeCborItem to @ac-kit/format-core’s Decoder contract, for decoding a CBOR sequence (RFC 8742) via decodeAll (a complete buffer) or DecodeStream (chunks arriving over time). Replaces a hand-rolled CborSequenceDecoder that reimplemented the same accumulate-and-dispatch loop DecodeDriver now provides generically.

error results are recoverable whenever the reader made progress before rejecting the item: consumed bytes are dropped and the next item is tried, which is what lets one bad item in a sequence not end the whole stream. An error at offset zero is reported as fatal, since retrying from an unmoved position could not terminate.

new CborItemDecoder(): CborItemDecoder

CborItemDecoder

decode(view): DecodeResult<DataValue, CborDecodeError>

Defined in: packages/format-cbor/src/binary/decoder.ts:275

Attempt to decode one value from the front of view.

view is a window into the driver’s buffer and is invalidated as soon as this call returns. Copy anything retained in the returned value.

Uint8Array

DecodeResult<DataValue, CborDecodeError>

Decoder.decode