npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@1-/ipv4

v0.1.0

Published

Convert IPv4 addresses to and from 32-bit integers / 将 IPv4 地址与 32 位整数相互转换

Readme

English | 中文


@1-/ipv4 : Convert IPv4 addresses to and from 32-bit integers

Functionality

Convert IPv4 address strings to 32-bit unsigned integers and vice versa. Enables efficient IP address arithmetic, range calculations, and compact storage.

Usage demonstration

Install the package:

npm install @1-/ipv4

Use in JavaScript modules:

import ipv4ToU32 from '@1-/ipv4/ipv4_u32';
import u32ToIpv4 from '@1-/ipv4/u32_ipv4';

// Convert IPv4 string to integer
const ipInt = ipv4ToU32('192.168.1.1'); // 3232235777

// Convert integer back to IPv4 string
const ipStr = u32ToIpv4(3232235777); // '192.168.1.1'

// Perform IP address arithmetic
const networkStart = ipv4ToU32('192.168.0.0');
const networkEnd = ipv4ToU32('192.168.255.255');
const totalAddresses = networkEnd - networkStart + 1; // 65536

Design rationale

The library uses bit manipulation for optimal performance:

  • IPv4 string parsing splits by dots and converts each octet
  • Bit shifting combines octets into 32-bit integer representation
  • Bitwise AND operations extract octets from integer representation
  • Uses unsigned right shift (>>>) to handle 32-bit integer boundaries correctly

Technology stack

  • JavaScript ES modules
  • Node.js runtime
  • @3-/int dependency for integer conversion

Code structure

src/
├── ipv4_u32.js    # Converts IPv4 string → 32-bit integer
└── u32_ipv4.js    # Converts 32-bit integer → IPv4 string

Historical context

The IPv4 addressing scheme was standardized in 1981 with RFC 791. Its 32-bit design allowed approximately 4.3 billion unique addresses, which seemed abundant at the time. The conversion between dotted-decimal notation and integer representation became essential for network programming, enabling efficient subnet calculations and routing table implementations. This library implements the fundamental conversion operations that underpin modern network infrastructure.

About

This library is developed by WebC.site.

WebC.site: A new paradigm of web development for AI


@1-/ipv4 : IPv4 地址与 32 位整数双向转换

功能介绍

实现 IPv4 地址字符串与 32 位无符号整数之间的双向转换。支持高效 IP 地址算术运算、范围计算及紧凑存储。

使用演示

安装包:

npm install @1-/ipv4

在 JavaScript 模块中使用:

import ipv4ToU32 from '@1-/ipv4/ipv4_u32';
import u32ToIpv4 from '@1-/ipv4/u32_ipv4';

// 将 IPv4 字符串转换为整数
const ipInt = ipv4ToU32('192.168.1.1'); // 3232235777

// 将整数转换回 IPv4 字符串
const ipStr = u32ToIpv4(3232235777); // '192.168.1.1'

// 执行 IP 地址算术运算
const networkStart = ipv4ToU32('192.168.0.0');
const networkEnd = ipv4ToU32('192.168.255.255');
const totalAddresses = networkEnd - networkStart + 1; // 65536

设计思路

库采用位操作实现最优性能:

  • IPv4 字符串解析通过点号分割并转换各八位组
  • 位移操作将八位组组合为 32 位整数表示
  • 位与操作从整数表示中提取八位组
  • 使用无符号右移(>>>)正确处理 32 位整数边界

技术栈

  • JavaScript ES 模块
  • Node.js 运行时
  • @3-/int 依赖项用于整数转换

代码结构

src/
├── ipv4_u32.js    # IPv4 字符串 → 32 位整数转换
└── u32_ipv4.js    # 32 位整数 → IPv4 字符串转换

历史故事

IPv4 地址方案于 1981 年 RFC 791 标准化。其 32 位设计可提供约 43 亿个唯一地址,在当时看似充足。IPv4 点分十进制表示法与整数表示法之间的转换成为网络编程基础,支撑子网计算和路由表实现。本库实现了现代网络基础设施所依赖的核心转换操作。

关于

本库由 WebC.site 开发。

WebC.site : 面向人工智能的网站开发新范式