query-registry
Query the npm registry for packuments, manifests, packages and download counts
Last updated 4 years ago by velut .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install query-registry 
SYNC missed versions from official npm registry.

query-registry

Build status Coverage jsDocs.io Language npm License

query-registry is an API wrapper for the npm registry API.

Features

  • Provides functions to:
    • Get registry metadata.
    • Get registry public keys.
    • Get packuments (package documents) with full package metadata.
    • Get abbreviated packuments with installation data only.
    • Get package manifests for each version of a package.
    • Get download counts for the registry and for packages.
    • Search packages by name and other specific criteria.
  • Works in the browser.
  • Validates registry responses with zod.
  • Automatically caches registry responses for a short time.
  • Supports third-party npm-compatible registries.

Useful resources

Install

[!NOTE] Make sure you have Zod v4 installed in your application to use this package.

Using npm:

npm add zod query-registry

Using yarn:

yarn add zod query-registry

Using pnpm:

pnpm add zod query-registry

Using bun:

bun add zod query-registry

Usage examples

Registry

Get the metadata about the npm registry itself, if available:

import { getRegistryMetadata } from "query-registry";

const metadata = await getRegistryMetadata();

Get the public signing keys for the npm registry:

import { getRegistrySigningKeys } from "query-registry";

const { keys } = await getRegistrySigningKeys();

Packuments (Package documents)

Get the abbreviated packument containing only the necessary data to install the react package:

import { getAbbreviatedPackument } from "query-registry";

const abbrPackument = await getAbbreviatedPackument("react");

Get the full packument containing all the data available about the react package:

import { getPackument } from "query-registry";

const packument = await getPackument("react");

Package manifests

Get the manifest containing the original package.json data plus additional registry metadata for the latest version of the react package:

import { getPackageManifest } from "query-registry";

const manifest = await getPackageManifest("react");

Get the manifest for react@18.2.0 (semver version):

import { getPackageManifest } from "query-registry";

const manifest = await getPackageManifest("react", "18.2.0");

Get the manifest for react@next (distribution tag):

import { getPackageManifest } from "query-registry";

const manifest = await getPackageManifest("react", "next");

Search packages

Search packages related to react (e.g., react, react-dom, ...):

import { searchPackages } from "query-registry";

const results = await searchPackages({ text: "react" });

Download counts

Get the total number of downloads for package react for the last month:

import { getPackageDownloads } from "query-registry";

const { downloads } = await getPackageDownloads("react", "last-month");

There are also these other download counts functions available: getBulkDailyPackageDownloads, getBulkPackageDownloads, getDailyPackageDownloads, getDailyRegistryDownloads and getPackageVersionsDownloads.

Cache

Clear the internal cache.

import { cache } from "query-registry";

cache.clear();

See the quick-lru package for the cache API.

License

MIT

Copyright (c) 2025 Edoardo Scibona

See LICENSE file.

Current Tags

  • 2.6.0                                ...           latest (4 years ago)
  • 2.5.0-0                                ...           next (4 years ago)

21 Versions

  • 2.6.0                                ...           4 years ago
  • 2.5.0                                ...           4 years ago
  • 2.5.0-0                                ...           4 years ago
  • 2.4.0                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.3.0-0                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.2.0-0                                ...           4 years ago
  • 2.1.0-0                                ...           4 years ago
  • 2.0.0                                ...           5 years ago
  • 2.0.0-5                                ...           5 years ago
  • 2.0.0-4                                ...           5 years ago
  • 2.0.0-3                                ...           5 years ago
  • 2.0.0-2                                ...           5 years ago
  • 2.0.0-1                                ...           5 years ago
  • 2.0.0-0                                ...           5 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.3.0                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 0
Last Month 4
Dependencies (5)

Copyright 2013 - present © cnpmjs.org | Home |