Kit
Variables

getI128Decoder

const getI128Decoder: (config?) => FixedSizeDecoder<bigint, 16>

Returns a decoder for 128-bit signed integers (i128).

This decoder deserializes i128 values from 16 bytes. The decoded value is always a bigint.

For more details, see getI128Codec.

Parameters

ParameterTypeDescription
config?NumberCodecConfigOptional configuration to specify endianness (little by default).

Returns

FixedSizeDecoder<bigint, 16>

A FixedSizeDecoder<bigint, 16> for decoding i128 values.

Example

Decoding an i128 value.

const decoder = getI128Decoder();
const value = decoder.decode(new Uint8Array([
  0xd6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
])); // -42n

See

getI128Codec

On this page