Skip to content

decodeUint32Key(bytes, offset?): number

Defined in: packages/key-encoding/src/scalars.ts:51

Decode the 4-byte encodeUint32Key encoding.

Every decode*Key function follows one rule for offset. Without it, bytes must be exactly one key and anything after the key is TRAILING_BYTES. With it, the key is read in place at offset and the bytes after it are left to the caller, which is how a hand-built composite key is read one field at a time.

Uint8Array

number

number

INVALID_KEY_VALUE when bytes is not a Uint8Array, or INVALID_OFFSET when offset is not an integer in 0 .. bytes.byteLength.

TRUNCATED_KEY when fewer than 4 bytes follow offset, or TRAILING_BYTES when offset is omitted and bytes is longer than 4 bytes.