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

ip-range-bigint-lookup

v1.0.2

Published

High-performance IP Range lookup using BigInt optimization and ipapi.is enrichment API.

Readme

IP Range Converter & Lookup Utility (BigInt Optimized)

A high-performance Node.js / JavaScript utility designed to convert IPv4 ranges into BigInt formats, compute subnet blocks, and seamlessly fetch ISP/Provider telemetry data once a match is found.

By converting IP addresses and ranges into BigInt integers, this library enables rapid database lookups (e.g., WHERE ip_bigint BETWEEN start_bigint AND end_bigint) instead of expensive and slow string-based regular expression matches.

Key Features

  • BigInt Conversion: Fast conversion of IPv4 strings (192.168.1.1) to BigInt numerical representations.
  • Block Calculation: Automatically aggregates raw IP ranges into CIDR blocks (e.g., /24, /16) and computes total available host counts.
  • High-Performance Search: Optimized range lookup using binary search or structured SQL indexing.
  • Enrichment API Integration: Automated fallbacks to fetch real-time metadata (ISP, Organization, ASN, Location) via ipapi.is once an IP space is resolved.

Database Optimization Concept

Searching IP ranges using strings or CIDR notations inside a large dataset can heavily degrade query times. Converting to BigInt flattens the range into an efficient numerical continuum:

| IP Notation | Start (BigInt) | End (BigInt) | Total IPs | | :--- | :--- | :--- | :--- | | 41.61.0.0 - 41.61.255.255 | 691863552n | 691929087n | 65,536 (256 x /24) | | 196.43.195.0 - 196.43.195.255| 3291136768n | 3291137023n | 256 (1 x /24) |

Installation

npm install ip-range-bigint-lookup

Quick Start

1. Parsing Ranges & Calculating Blocks

const { ipToBigInt, calculateBlocks } = require('ip-range-bigint-lookup');

const range = {
  start: '196.220.32.0',
  end: '196.220.63.255'
};

const startBigInt = ipToBigInt(range.start); // 3296043008n
const endBigInt = ipToBigInt(range.end);     // 3296051199n

console.log(`BigInt Range: ${startBigInt}n to ${endBigInt}n`);

const analysis = calculateBlocks(range.start, range.end);
console.log(analysis);
// Output: { totalBlocks24: 32, totalAddresses: 8192 }

2. Matching and Fetching Provider Details

When a query target hits a pre-calculated internal range, the utility extracts full context by integrating with the ipapi.is live data stream.

const { LookupEngine } = require('ip-range-bigint-lookup');

const engine = new LookupEngine();

// Seed your local internal ranges
engine.addRange('41.61.0.0', '41.61.255.255', { providerId: 'ISP-ALPHA' });

async function checkAndEnrich(targetIp) {
  const match = engine.find(targetIp);
  
  if (match) {
    console.log(`Match Found locally! Fetching comprehensive provider data...`);
    
    // Fetch live intelligence data from ipapi.is
    const response = await fetch(`https://api.ipapi.is/?q=${targetIp}`);
    const data = await response.json();
    
    console.log('--- Provider Intel ---');
    console.log(`ASN: ${data.asn.asn}`);
    console.log(`Org: ${data.asn.org}`);
    console.log(`ISP: ${data.company.name}`);
    console.log(`Location: ${data.location.country}, ${data.location.city}`);
  } else {
    console.log('IP is outside tracked blocks.');
  }
}

checkAndEnrich('41.61.5.12');

API Reference

ipToBigInt(ipString)

Converts an IPv4 string into a safe mathematical BigInt.

calculateBlocks(startIp, endIp)

Parses the difference between two IP thresholds and returns the total count of /24 sub-allocations along with raw address metrics.

LookupEngine.find(ipString)

Executes an in-memory binary search against configured range boundaries using BigInt logic. Returns the matching context or null.

STRUCTURE PROJECT

ip-bigint-lookup/ ├── src/ │ ├── utils.js # Fungsi konversi BigInt & hitung blok │ ├── engine.js # Class untuk pencarian/matching IP │ └── index.js # Entry point utama library ├── example/ │ └── test.js # Contoh implementasi & uji coba kode ├── package.json # Konfigurasi project npm └── README.md # Dokumentasi (yang sudah dibuat sebelumnya)

License

MIT