toStringArray() function

Unpacks a binary list back into CIDR text.

Signature:

export declare function toStringArray(list: Buffer, type: NetworkType, canonical?: boolean): string[];

Parameters

Parameter

Type

Description

list

Buffer

a buffer produced by toBinaryList()

type

NetworkType

which family the buffer holds

canonical

boolean

(Optional) for IPv6, render expanded rather than compressed addresses

Returns:

string[]

CIDR records covering the same addresses as the buffer.

Default Value

canonical defaults to false

Remarks

Not necessarily the records you packed. Each stored range is re-expressed as its minimal cover by intRangeToCidr(), so a range that came from one record comes back as one record, but a range that does not align to a single prefix comes back as several. Round-tripping is therefore lossless in addresses covered and not in record count.

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