Kit
Interfaces

VariableSizeDecoder

An object that can decode a variable-size byte array into a value of type TTo.

See Decoder to learn more about creating and composing decoders.

Example

const decoder: VariableSizeDecoder<number>;
const value = decoder.decode(bytes);

See

Type Parameters

Type ParameterDescription
TToThe type of the decoded value.

Properties

PropertyModifierTypeDescription
decodereadonly(bytes, offset?) => TToDecodes the provided byte array at the given offset (or zero) and returns the value directly.
maxSize?readonlynumberThe maximum possible size of an encoded value in bytes, if applicable.
readreadonly(bytes, offset) => [TTo, number]Reads the encoded value from the provided byte array at the given offset. Returns the decoded value and the offset of the next byte after the encoded value.

On this page