intToIp() function

Renders an integer address back to text.

Signature:

export declare function intToIp(intIp: bigint, type: NetworkType, canonical?: boolean): string;

Parameters

Parameter

Type

Description

intIp

bigint

the address as produced by ipToInt()

type

NetworkType

which family to render it as; the integer alone does not say

canonical

boolean

(Optional) for IPv6, emit the full expanded form instead of the compressed one. Ignored for IPv4, which has only one form.

Returns:

string

Dotted-quad for IPv4, colon-hex for IPv6.

Default Value

canonical defaults to false, i.e. compressed IPv6

Remarks

The inverse of ipToInt(), but type is not optional here and cannot be inferred: the same integer is a valid address in both families, so passing the wrong one yields a plausible, wrong address rather than an error.

There is no range check either. A value wider than the family renders from whatever bits fall in each group's position, so an IPv6-sized integer rendered as IPv4 silently produces nonsense.

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