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.
Implements
Section titled “Implements”Decoder<DataValue,Uint8Array,CborDecodeError>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CborItemDecoder():
CborItemDecoder
Returns
Section titled “Returns”CborItemDecoder
Methods
Section titled “Methods”decode()
Section titled “decode()”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.
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”DecodeResult<DataValue, CborDecodeError>
Implementation of
Section titled “Implementation of”Decoder.decode