decodeIpAddress
decodeIpAddress
Converts raw IP address bytes back to a human-readable string.
Returns dotted-decimal IPv4 for 4-byte input and colon-separated hex IPv6 for 16-byte input.
Throws on any other length.
ts
function decodeIpAddress(
bytes: Uint8Array,
): stringParameters
bytes:Uint8Array— Raw IPv4 or IPv6 address bytes.
Returns — The decoded address string.
Examples
ts
decodeIpAddress(Uint8Array.of(127, 0, 0, 1));
// '127.0.0.1'