Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

internet-address

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

internet-address

Parse, query, manipulate, and serialize IPv4/6 addresses.

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

internet-address

This is a tiny IPv4 and IPv6 utility library forked from ipaddr.js.

Requires Node.js 18.20+, 20.10+, 22.0+, or above.

Highlights

Tree-Shaking

internet-address supports tree shaking meaning you can pull in only the functionality you need versus ipaddr.js's all-or-nothing approach.

Small Bundle Size

Pulling in every module costs under 3KiB minified and gzipped. This package supports tree shaking however meaning if you only need IPv4 parsing for example, it'll only cost you 1.1KiB instead of the full 3KiB.

Browser Support

This package is written in standard ESM using only JavaScript builtins meaning it can be imported into browsers via a CDN without Node.js polyfills:

import { IPv4, IPv6, CIDR, process, subnetMatch } from "https://esm.sh/internet-address"

No Unnecessary Abstractions

An IPv4 address is an array of 4 bytes so IPv4.parse() returns you a Uint8Array of 4 bytes. No need for serialization, the data type is already in its basic form.

Usage

Install with npm install internet-address. Make sure you have "type": "module" in your package.json.

Import the utilities with:

import { IPv4, IPv6, CIDR, process, subnetMatch } from "internet-address"

View full documentation.

Keywords

ip

FAQs

Package last updated on 31 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts