The IPv4 address in string, number, or octet array format.
A new Ipv4Address instance.
import { ipv4 } from 'cidr-block';
const addr1 = ipv4.address("192.168.1.1");
const addr2 = ipv4.address(3232235777);
const addr3 = ipv4.address([192, 168, 1, 1]);
import { ipv4 } from 'cidr-block';
const addr = ipv4.address("192.168.1.1");
addr.toString(); // "192.168.1.1"
addr.toNumber(); // 3232235777
addr.octets(); // [192, 168, 1, 1]
addr.toBinaryString(); // "11000000.10101000.00000001.00000001"
import { ipv4 } from 'cidr-block';
const addr = ipv4.address("192.168.1.1");
addr.equals("192.168.1.1"); // true
addr.isGreaterThan("192.168.1.0"); // true
addr.isLessThan("192.168.1.2"); // true
import { ipv4 } from 'cidr-block';
const addr = ipv4.address("192.168.1.1");
addr.nextAddress()?.toString(); // "192.168.1.2"
addr.previousAddress()?.toString(); // "192.168.1.0"
Creates a new Ipv4Address instance from the given literal. Valid formats include string, number, or octet array.