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

npm-query

v1.1.0

Published

A module to query the NPM registry for modules and download statistics

Readme

node-npm-query

The npm-query library allows you to query modules from the NPM registry, get module details and download statistics.

npm install --save npm-query

Usage

Query Modules

Get Module

The module contains all of the data including versions, contributors, the package.json file for every release, ...

import { NpmClient } from 'npm-query';

const npmClient = new NpmClient();

// Get the bluebird module.
npmClient.getModule('bluebird')
  .then(module => {
    console.log({
      name: module.name,
      description: module.description,
      keywords: module.keywords,
      bugs: module.bugs
    });
  })
  .catch(err => {
    console.log('Error fetching module:', err);
  });

Get Modules Stream

The library allows you to get all modules since a certain point (a sequence).

import { NpmClient } from 'npm-query';

const npmClient = new NpmClient();

// Get all modules since a certain point (you can retrieve the sequence from the modules).
const lastSequence = 1000000;

// Create a stream and listen of modules.
const stream = npmClient.getModuleStream(lastSequence);
stream.on('data', (module) => {
  console.log({
    name: module.name,
    description: module.description,
    keywords: module.keywords,
    bugs: module.bugs,
    sequence: module.seq
  });
});
stream.on('error', (err) => {
  console.log('Error in module stream:', err);
});

// Start the stream. You can call pause/resume/stop
stream.start();

Downloads

Downloads for a single module

You can get the statistics for the last-day, last-week and last-month.

// Get the downloads for a single period.
npmClient.getDownloadsForPeriod('bluebird', 'last-day')
  .then(downloads => {
    console.log(downloads);
  })
  .catch(err => {
    console.log('Error fetching downloads:', err);
  });

Returns:

{
  "downloads": "351701",
  "start": "2016-05-20",
  "end": "2016-05-20",
  "package": "bluebird"
}

You can also get the statistics for all periods:

// Get the downloads for all periods.
npmClient.getDownloads('bluebird')
  .then(downloads => {
    console.log(downloads);
  })
  .catch(err => {
    console.log('Error fetching downloads:', err);
  });

Returns:

{
  "last_day": "351701",
  "last_week": "2057550",
  "last_month": "7966475"
}

Collect download statistics in bulk

import { NpmDownloadsQueue } from 'npm-query';

// Initialize the queue.
const queue = new NpmDownloadsQueue();
queue.on('error', (err) => {
  console.log('Error fetching downloads:', err);
});
queue.on('data', (moduleId, downloads) => {
  console.log(moduleId, downloads);
});

// Add modules for which you want download statistics.
queue.add('bluebird');
queue.add('jquery');

// You can inspect the current queue length.
console.log(queue.length());

// You can also control the queue
queue.pause();
queue.resume();
queue.stop();

Returns:

bluebird { last_day: 351701, last_week: 2057550, last_month: 7966475 }
jquery { last_day: 86723, last_week: 448441, last_month: 1882966 }