Skip to content

convertIPv6BinaryToString

reference
1 min readUpdated

Kind: Function

Source: src/utils/ipaddr.ts

Part of: Utils

Convert a binary representation of an IPv6 address to a string.

convertIPv6BinaryToString converts an IPv6 address from its binary representation into a string. Use it at boundaries where binary address data must be displayed, logged, or passed to code that expects an IPv6 string.

Signature

ts
function convertIPv6BinaryToString(ipV6: bigint): string

Parameters

NameType
ipV6bigint

Returns: string

Diagram

mermaid
graph LR
  A[Binary IPv6 value] --> B[convertIPv6BinaryToString]
  B --> C[IPv6 string]

Usage

ts
import { convertIPv6BinaryToString } from "./utils/ipaddr";

// Obtain the binary IPv6 value from a network, parser, or storage layer.
declare const binaryIPv6: string;

const ipv6Address = convertIPv6BinaryToString(binaryIPv6);

console.log(ipv6Address);

AI Coding Instructions

  • Pass the binary IPv6 value to this function, not an already formatted IPv6 string.
  • Keep binary-to-string conversion at input or output boundaries rather than spreading address formatting logic across callers.
  • Preserve the binary value unchanged before conversion; changing its order changes the resulting address.
  • Use the returned string for display, logging, serialization, or APIs that accept textual IPv6 addresses.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (1)

  • IPRestrictionRulesrc/middleware/ip-restriction/index.ts:38

Was this page helpful?

Download as PDF
convertIPv6BinaryToString — Hono (narrator proof)