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

peeringdb-ts

v1.0.0

Published

TypeScript client for the PeeringDB API. Search networks, IXPs, facilities. Zero dependencies.

Readme

peeringdb-ts

npm version License: MIT TypeScript Zero Dependencies

TypeScript client for the PeeringDB API. Search networks, IXPs, and facilities. Zero dependencies.

Install

npm install peeringdb-ts

Requires Node.js 18+ (uses native fetch).

Quick Start

import { PeeringDBClient } from 'peeringdb-ts';

const pdb = new PeeringDBClient();

// Look up a network by ASN
const cloudflare = await pdb.getNetworkByASN(13335);
console.log(cloudflare.name);        // "Cloudflare, Inc."
console.log(cloudflare.info_traffic); // "100-200 Gbps"

// Find where a network peers
const connections = await pdb.getNetworkIXConnections(13335);
console.log(`Cloudflare peers at ${connections.length} IXP ports`);

// Search IXPs
const ixps = await pdb.searchIXPs('DE-CIX');
console.log(ixps.map(ix => `${ix.name} (${ix.city}, ${ix.country})`));

// Search facilities
const facilities = await pdb.searchFacilities('Equinix');
console.log(facilities.map(f => `${f.name} - ${f.city}, ${f.country}`));

API Reference

Constructor

const pdb = new PeeringDBClient({
  baseUrl?: string,   // Default: "https://www.peeringdb.com/api"
  timeout?: number,   // Default: 10000 (ms)
  apiKey?: string,    // Optional API key for higher rate limits
});

Networks

pdb.searchNetworks(query: string): Promise<Network[]>
pdb.getNetwork(id: number): Promise<Network>
pdb.getNetworkByASN(asn: number): Promise<Network>
pdb.listNetworks({ limit?, skip? }): Promise<Network[]>

IX Connections

pdb.getNetworkIXConnections(asn: number): Promise<IXConnection[]>
pdb.getIXConnections(ixId: number): Promise<IXConnection[]>

Network Facilities

pdb.getNetworkFacilities(asn: number): Promise<NetworkFacility[]>

Internet Exchange Points

pdb.searchIXPs(query: string): Promise<IXP[]>
pdb.getIXP(id: number): Promise<IXP>
pdb.listIXPsByCountry(country: string): Promise<IXP[]>

Facilities

pdb.searchFacilities(query: string): Promise<FacilityInfo[]>
pdb.getFacility(id: number): Promise<FacilityInfo>
pdb.listFacilitiesByCity(city: string): Promise<FacilityInfo[]>
pdb.listFacilitiesByCountry(country: string): Promise<FacilityInfo[]>

Error Handling

import { PeeringDBClient, PeeringDBError } from 'peeringdb-ts';

try {
  const network = await pdb.getNetworkByASN(99999999);
} catch (err) {
  if (err instanceof PeeringDBError) {
    console.error(`API error ${err.statusCode}: ${err.message}`);
  }
}

Types

All PeeringDB API response types are fully typed and exported:

import type {
  Network,
  IXP,
  IXConnection,
  FacilityInfo,
  NetworkFacility,
  PeeringDBClientOptions,
} from 'peeringdb-ts';

Authentication

PeeringDB allows anonymous access but with rate limits. For higher limits, create an API key at peeringdb.com and pass it to the client:

const pdb = new PeeringDBClient({ apiKey: 'your-api-key' });

License

MIT