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

netaddr

v1.1.0

Published

Utility for IP addresses and CIDR expressions

Readme

netaddr.js

Node.js utility package for working with IP addresses and CIDR ranges.

Installation

$ npm install netaddr --save

Usage

var Addr = require('netaddr').Addr;

// Create a fixed IP address from a string
var localhost = Addr('127.0.0.1');

// Create  CIDR range from a string
var subnet = Addr('10.0.0.0/16');

// Create a CIDR range from an integer and prefix
var subnet = Addr(167772160, 16);

// Convert an IP address to an integer
var intval = Addr('127.0.0.1').toInt();

// Get the network address
var network = subnet.network();

// Get the broadcast address
var broadcast = subnet.broadcast();

// Mask the address with a new prefix
var masked = subnet.mask(24);

// Check if one CIDR contains another CIDR or IP
subnet.contains(Addr('10.0.3.0/24')); // true

// Check where two CIDRs intersect
subnet.intersect(Addr('10.0.3.0/24'));

// Increment an address (non-mutating)
localhost.increment();

// Decrement an address (non-mutating)
localhost.decrement();

// Find the next adjacent subnet
subnet.nextSibling();

// Find the previous adjacent subnet
subnet.prevSibling();

Attempts to create an invalid Addr will throw an Error.

Limitations

Currently only IPv4 is supported, though there are plans to add IPv6 support. This is complicated by the fact JavaScript does not support 64-bit integers, let alone 128-bit integers.

Copyright & License

Copyright © 2015 Chris Corbyn. See the LICENSE file for details.