sizeOf() function

How many bytes one address of the given family occupies.

Signature:

export declare function sizeOf(type: NetworkType): number;

Parameters

Parameter

Type

Description

type

NetworkType

the address family to size

Returns:

number

16 for NetworkType.IPV6, otherwise 4.

Remarks

Anything that is not exactly IPV6 is treated as IPv4, so an unrecognised value silently sizes as IPv4 rather than throwing. Callers that need the input validated should check it themselves.

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