The IPv6 address in string, bigint, or hextets array format.
A new Ipv6Address instance.
import { ipv6 } from 'cidr-block';
const addr1 = ipv6.address("2001:db8::1");
const addr2 = ipv6.address(42540766411282592856903984951653826561n);
const addr3 = ipv6.address([0x2001, 0xdb8, 0, 0, 0, 0, 0, 1]);
import { ipv6 } from 'cidr-block';
const addr = ipv6.address("2001:db8::1");
addr.toString(); // "2001:db8::1" (compressed)
addr.toFullString(); // "2001:0db8:0000:0000:0000:0000:0000:0001"
addr.toBigInt(); // 42540766411282592856903984951653826561n
addr.hextets(); // [0x2001, 0xdb8, 0, 0, 0, 0, 0, 1]
import { ipv6 } from 'cidr-block';
const addr = ipv6.address("2001:db8::1");
addr.equals("2001:db8::1"); // true
addr.isGreaterThan("2001:db8::"); // true
addr.isLessThan("2001:db8::2"); // true
import { ipv6 } from 'cidr-block';
const addr = ipv6.address("2001:db8::1");
addr.nextAddress()?.toString(); // "2001:db8::2"
addr.previousAddress()?.toString(); // "2001:db8::"
Creates a new Ipv6Address instance from the given literal. Valid formats include string (with :: compression support), bigint, or hextets array.