toBigIntLE() function

Reads a little-endian byte sequence as an unsigned bigint.

Signature:

export declare function toBigIntLE(buf: Buffer | Uint8Array): bigint;

Parameters

Parameter

Type

Description

buf

Buffer | Uint8Array

the bytes to read, least significant first

Returns:

bigint

The value they encode. An empty input gives 0n.

Remarks

Always unsigned — there is no sign bit and no length limit, so a 16-byte IPv6 address reads as a plain positive integer. That is what lets one comparison path serve both families.

Little-endian is the convention this package writes with (toBufferLE()), so the pair round-trips. Reading a big-endian buffer with it returns a byte-reversed value rather than an error.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.