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

ipdata

v3.0.0

Published

JavaScript library to gather information for an ip using https://ipdata.co.

Readme

IPData Node.js Library

A Node.js library for the ipdata API. Look up IP addresses for geolocation, threat intelligence, company data, and more.

Requires Node.js 18 or later. Uses the native fetch API with zero HTTP dependencies.

Table of Contents

Install

npm install ipdata

Use

Import Library

import IPData from 'ipdata';

A named export is also available:

import { IPData } from 'ipdata';

CommonJS:

const { IPData } = require('ipdata');

Create an Instance

Create an instance of the IPData class with your API key.

const ipdata = new IPData('<apiKey>');

Caching

The library caches up to 4096 responses for 24 hours using an LRU cache by default. You can configure the cache by passing an options object as the second parameter.

const ipdata = new IPData('<apiKey>', {
  max: 1000, // max number of entries
  ttl: 10 * 60 * 1000, // 10 minutes
});

To disable caching, set ttl to 1:

const ipdata = new IPData('<apiKey>', { ttl: 1 });

EU Endpoint

By default requests are routed to the global endpoint (https://api.ipdata.co). To ensure end-user data stays in the EU, pass the EU endpoint as the third parameter.

import IPData, { EU_BASE_URL } from 'ipdata';

const ipdata = new IPData('<apiKey>', undefined, EU_BASE_URL);

You can also pass any custom base URL:

const ipdata = new IPData('<apiKey>', undefined, 'https://eu-api.ipdata.co/');

Lookup

Look up the current machine's IP when called with no arguments:

const info = await ipdata.lookup();
// info.ip === '<your ip>'

Pass an IP address to look it up:

const info = await ipdata.lookup('1.1.1.1');
// info.ip === '1.1.1.1'

Return a single field:

const info = await ipdata.lookup('1.1.1.1', 'city');

Return multiple fields:

const info = await ipdata.lookup('1.1.1.1', undefined, ['ip', 'city']);

Named Parameters

You can also pass a single object, which is convenient when you only need fields or selectField without specifying an IP.

// Look up your own IP with specific fields
const info = await ipdata.lookup({ fields: ['ip', 'city'] });

// Look up a specific IP with a single field
const info = await ipdata.lookup({ ip: '1.1.1.1', selectField: 'city' });

Bulk Lookup

Look up multiple IP addresses in a single API call:

const info = await ipdata.bulkLookup(['1.1.1.1', '1.0.0.1']);
// info[0].ip === '1.1.1.1'

With field filtering:

const info = await ipdata.bulkLookup(['1.1.1.1', '1.0.0.1'], ['ip', 'city']);

Response Fields

The following fields are available for use with selectField and fields:

ip, is_eu, city, region, region_code, country_name, country_code, continent_name, continent_code, latitude, longitude, asn, company, organisation, postal, calling_code, flag, emoji_flag, emoji_unicode, carrier, languages, currency, time_zone, threat, count

asn{ asn, name, domain, route, type }

company{ name, domain, network, type }

carrier{ name, mcc, mnc }

threat{ is_tor, is_icloud_relay, is_proxy, is_datacenter, is_anonymous, is_known_attacker, is_known_abuser, is_threat, is_bogon, blocklists }

TypeScript

The library is written in TypeScript and exports the following types:

import IPData, { EU_BASE_URL, CacheConfig, LookupParams, LookupResponse } from 'ipdata';