Registry / http-networking / ip-address

ip-address

JSON →
library1.5.0jsnpmunverified

A JavaScript/TypeScript library for parsing, validating, and manipulating IPv4 and IPv6 addresses. Current stable version is 10.1.0, released with breaking changes from v9 (native BigInt support). Works in Node.js (>=12) and browsers via bundlers. Key differentiators: built-in Teredo inspection, subnet calculations, special property detection, and ~1,600 test cases. Ships TypeScript definitions.

npm install ip-address
INSTALL
IMPORT
SIG · IP-ADDRESS
I
ip-address
http-networkingjavascriptv1.5.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Address6
import { Address6 } from 'ip-address'
const Address6 = require('ip-address').Address6
ESM import is preferred. CommonJS require still works but may be deprecated in future.
Address4
import { Address4 } from 'ip-address'
const Address6 = require('ip-address')
Note the correct named import is Address4, not Address6.
IPv6
import { IPv6 } from 'ip-address'
import { Address6 as IPv6 } from 'ip-address'
IPv6 is an alias for Address6. Using Address6 directly is more common.

Basic usage of Address4 and Address6 showing validation, formatting, Teredo inspection, and subnet calculation.

import { Address4, Address6 } from 'ip-address'; // IPv4 example const ipv4 = new Address4('192.168.1.1'); console.log(ipv4.isValid()); // true console.log(ipv4.correctForm()); // '192.168.1.1' console.log(ipv4.subnetMask); // 32 // IPv6 example const ipv6 = new Address6('2001:0:ce49:7601:e866:efff:62c3:fffe'); console.log(ipv6.isValid()); // true console.log(ipv6.canonicalForm()); // '2001:0:ce49:7601:e866:efff:62c3:fffe' // Inspect Teredo const teredo = ipv6.inspectTeredo(); console.log(teredo.client4); // '157.60.0.1' // Subnet calculation const subnet = ipv6.subnet(64); console.log(subnet.canonicalForm()); // '2001:0:ce49:7601::/64'
Debug
Known issues
breakingfromBigInteger() renamed to fromBigInt(); bigInteger() renamed to bigInt()
fix
Use fromBigInt() and bigInt() instead; these now return native BigInt values.
affects: >=10.0.0
deprecatedUsing CommonJS require() may be deprecated in future versions
fix
Switch to ESM import syntax.
affects: >=10.0.0
gotchaThe library uses native BigInt; ensure your runtime supports BigInt (Node.js >=10.4, modern browsers).
fix
If you need older JS engine support, stay on v9.x.
affects: >=10.0.0
Errors
Common errors & fixes
TypeError: Address6 is not a constructor
Using incorrect import path or mixing default and named exports
fix
Use: import { Address6 } from 'ip-address' or const { Address6 } = require('ip-address')
Error: ip-address requires BigInt support
Runtime environment does not support native BigInt
fix
Upgrade Node.js to >=10.4 or use older ip-address v9.x
Module not found: Can't resolve 'ip-address'
Package not installed or import path is wrong
fix
Run: npm install ip-address
Upgrade
Version history
1.5.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
ip-address — npm install ip-address · libregistry