# toBufferLE() function · @imqueue/net

Source: https://imqueue.org/api/net/latest/net.tobufferle/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/net 3.0.2 — generated reference, not hand-written

Writes an unsigned `bigint` as a little-endian buffer of an exact size.

**Signature:**

```typescript
export declare function toBufferLE(value: bigint, size: number): Buffer;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| value | bigint | a non-negative value to encode |
| size | number | bytes in the resulting buffer; the result is always this long |


**Returns:**

Buffer

A new buffer of exactly `size` bytes, zero-padded at the high end.

## Exceptions

RangeError if `size` is not a positive integer, if `value` is negative, or if `value` needs more than `size` bytes. The size check happens after the bytes are written, so it catches overflow rather than silently truncating.

## Remarks

The inverse of [toBigIntLE()](https://imqueue.org/api/net/latest/net.tobigintle/). Fixed width is the point: a network record holds two addresses at a known offset, so every address must occupy [sizeOf()](https://imqueue.org/api/net/latest/net.sizeof/) bytes whatever its magnitude.

