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

whois2rdap

v0.1.2

Published

Convert WHOIS responses into RDAP-shaped objects

Readme

whois2rdap

Convert WHOIS responses into RFC 9083 RDAP-shaped JSON, with an optional one-shot lookup that prefers the official RDAP service when one is registered with IANA.

한국어 문서: README.ko.md

Features

  • lookupRdap(domain) — single call that does the right thing:
    1. Checks the IANA RDAP bootstrap (data.iana.org/rdap/dns.json).
    2. If the TLD has an official RDAP service, fetches <base>/domain/<name> directly.
    3. Otherwise falls back to a TCP WHOIS query and converts the response.
  • whoisToRdap(text) — pure converter from raw WHOIS text to an RDAP domain object.
  • whoisQuery({ host, query }) — low-level port-43 client.
  • RFC 9083 compliant outputobjectClassName, rdapConformance, jCard vcardArray, EPP→RDAP status mapping (RFC 8056), port43, notices, lowercase ldhName normalization.
  • TLD parsers — currently .kr (KISA/KRNIC) and .cn (CNNIC). The architecture is pluggable; add a parser per TLD in src/parsers/.
  • Zero runtime dependencies. Built with tsup for ESM + CJS + .d.ts.

Install

npm install whois2rdap
# or
bun add whois2rdap
# or
pnpm add whois2rdap

Requires Node.js ≥ 18 (uses native fetch and AbortSignal.timeout).

Quick start

import { lookupRdap } from "whois2rdap";

const rdap = await lookupRdap("oup.kr");
console.log(rdap.ldhName);   // "oup.kr"
console.log(rdap.status);    // ["client transfer prohibited"]
console.log(rdap.port43);    // "whois.kr"

For a TLD that has an IANA-registered RDAP server (e.g. .com, .net, .org), the call goes straight to that server — no WHOIS conversion happens.

const rdap = await lookupRdap("example.com");
// → fetched from https://rdap.verisign.com/com/v1/domain/example.com

API

lookupRdap(domain, options?)

| option | type | description | | --- | --- | --- | | useIanaBootstrap | boolean | Disable the IANA lookup and force the WHOIS path. Default true. | | bootstrap | BootstrapLoadOptions | Forwarded to the bootstrap loader (url, ttlMs, force, fetchImpl, signal). | | fetchImpl | typeof fetch | Inject a custom fetch (testing, proxies). | | server | string | Pin a WHOIS server. Setting this also bypasses the IANA bootstrap. | | port | number | WHOIS port. Default 43. | | timeoutMs | number | Timeout for either path. Default 10_000. | | normalizeCase | boolean | Lowercase ldhName on the domain and nameservers. Default true. | | includeRawWhoisNotice | boolean | Include the raw WHOIS text as an extra notices[] entry (WHOIS path only). |

whoisToRdap(text, options?)

Pure conversion. Detects .kr (or a KRNIC banner) and dispatches to the KR parser; everything else returns a minimal stub. Honors sourceServer, includeRawWhoisNotice, normalizeCase.

whoisQuery({ host, query, port?, timeoutMs? })

Raw port-43 client returning the response as a UTF-8 string.

IANA bootstrap helpers

import {
  loadIanaRdapBootstrap,
  rdapBaseUrlsForTld,
  setIanaRdapBootstrapCache,
  clearIanaRdapBootstrapCache,
} from "whois2rdap";

The bootstrap is fetched lazily on first use and cached in memory for 24h.

Output shape (.kr example)

{
  "objectClassName": "domain",
  "rdapConformance": ["rdap_level_0"],
  "ldhName": "oup.kr",
  "status": ["client transfer prohibited"],
  "entities": [
    { "objectClassName": "entity", "roles": ["registrant"], "vcardArray": [...] },
    { "objectClassName": "entity", "roles": ["administrative"], "vcardArray": [...] },
    { "objectClassName": "entity", "roles": ["registrar"], "vcardArray": [...] }
  ],
  "nameservers": [
    { "objectClassName": "nameserver", "ldhName": "adel.ns.cloudflare.com" },
    { "objectClassName": "nameserver", "ldhName": "trey.ns.cloudflare.com" }
  ],
  "events": [
    { "eventAction": "registration",  "eventDate": "2013-08-03T00:00:00Z" },
    { "eventAction": "last changed",  "eventDate": "2022-08-08T00:00:00Z" },
    { "eventAction": "expiration",    "eventDate": "2026-08-03T00:00:00Z" }
  ],
  "secureDNS": { "delegationSigned": true },
  "port43": "whois.kr",
  "notices": [
    { "title": "Source", "description": ["Derived from WHOIS data served by whois.kr."] }
  ]
}

Supported TLDs

| TLD | Path | Notes | | --- | --- | --- | | .com, .net, .org, .site, .blog, ... | IANA RDAP passthrough | Anything in data.iana.org/rdap/dns.json | | .kr | WHOIS → KR parser | KISA/KRNIC, English section preferred | | .cn | WHOIS → CN parser | CNNIC, ROID → handle, signedDelegationsecureDNS |

PRs welcome for more TLDs — add a parser at src/parsers/<tld>.ts and wire it into src/convert.ts.

RFC 9083 conformance

| Requirement | Status | | --- | --- | | objectClassName, rdapConformance | ✅ | | jCard (vcardArray) per RFC 7095 | ✅ | | EPP → RDAP status mapping (RFC 8056) | ✅ | | port43, notices | ✅ (WHOIS path) | | events, entities, nameservers, secureDNS.delegationSigned | ✅ | | secureDNS.dsData / keyData | ❌ (WHOIS rarely exposes) | | links self-reference | ❌ (no canonical URL known) | | unicodeName for IDN | ❌ |

Development

bun install
bun run typecheck
bun run test
bun run build

License

MIT