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 🙏

© 2024 – Pkg Stats / Ryan Hefner

npm-stats

v1.2.0

Published

Convenience module for getting back data from an NPM registry

Downloads

169

Readme

npm-stats

Convenience module for getting back data from an NPM registry. All of the methods return a JSON stream, and/or take a callback. Where specified, some methods take an optional options object as well.

API

registry = require('npm-stats')([url, options])

Returns a new registry instance, defaulting to isaacs.iriscouch.com.

Options:

  • dirty: pass this as true to disable data cleaning, instead getting the raw data direct from NPM's CouchDB.
  • modules: the database to use for retrieving modules. Defaults to "registry".
  • downloads: the database to use for retrieving download data. Defaults to "downloads".
  • users: the database to use for retrieving users. Defaults to "users".

registry.list()

Returns an array containing every module currently in the chosen NPM registry.

registry.listByDate(options)

Get a list of each module in the chosen NPM registry, sorted by date last updated, in ascending order.

You can also pass the following options:

  • since: only include modules updated since this date.
  • until: only include modules updated before this date.

Keywords

registry.keyword(name).count()

Get the number of modules using a specific keyword.

registry.keyword(name).list()

Get a list of modules using a specific keyword.

Users

registry.user(name).count()

Get the number of modules a user has authored.

registry.user(name).list()

Get a list of the modules a user has authored.

registry.user(name).starred()

Get a list of the modules a user has starred.

Modules

registry.module(name).info()

Returns the data normally accessible from https://registry.npmjs.org/:pkg.

registry.module(name).version(version)

Returns the data normally accessible from http://registry.npmjs.org/:pkg/:version.

registry.module(name).downloads()

Returns a list of download counts for the module, by date, e.g.:

[
  { "date": "2012-12-10", "value": 64 },
  { "date": "2012-12-11", "value": 82 }
]

Days without a download are omitted. Options:

  • since: The earliest date to return download info from.
  • until: The latest date to return download info from.

registry.module(name).stars()

Returns a list of the users who have starred a module.

registry.module(name).dependents()

Returns a list of modules that depend on a module.

registry.module(name).latest()

Returns the latest package.json file for a module.

registry.module(name).field(name, [callback])

Returns a field from the latest package.json file for a module.

registry.module(name).size()

Returns data on the module's size, e.g.

{
  "_id": "browserify",
  "size": 26338241,
  "count": 179,
  "avg": 147141.01117318432
}