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 🙏

© 2025 – Pkg Stats / Ryan Hefner

package-stream

v3.1.0

Published

An endless stream of clean package data from the npm registry.

Downloads

114

Readme

package-stream

An endless stream of nice package data from the npm registry.

See also all-the-packages, a similar package designed for offline use.

Installation

npm install package-stream --save

Usage

The stream is an event emitter that emits two events: package and up-to-date. The up-to-date event is emitted when the stream reaches the end of all existing packages, but unlike typical read streams, this stream has no end event. It remains open indefinitely, emitting package events as new package versions are published to the npm registry in real time.

const registry = require('package-stream')()

registry
  .on('package', function (pkg, seq) {
    // pkg: nice clean package object
    // seq: the sequence number of the "package" event, useful for logging/tracking
  })
  .on('up-to-date', function () {
    // consumed all changes (for now)
    // The stream will remain open and continue receiving package
    // updates from the registry as they occur in real time.
  })

Nice Packages

Each object emitted by the package event is a nice-package instance. Nice packages have cleaner metadata than you'd get directly from the npm registry, and some handy convenience methods .

Here's an example that uses the somehowDependsOn() method to find all packages the have choo in their dependencies or devDependencies:

const registry = require('package-stream')()
const dependents = []

registry
  .on('package', function (pkg) {
    if (pkg.someHowDependsOn('choo')) dependents.push(pkg.name)
  })
  .on('up-to-date', function () {
    process.stdout.write(JSON.stringify(dependents))
    process.exit()
  })

To see the full list of available methods, check out the nice-package documentation.

Options

The changes-stream package is used under the hood, and all of its options are supported by package-stream. The default options used by package-stream are:

{
  db: 'https://replicate.npmjs.com',
  include_docs: true
}

The options you provide are merged with the defaults above.

Tests

npm install
npm test

Dependencies

  • changes-stream: Simple module that handles getting changes from couchdb
  • got: Simplified HTTP requests
  • nice-package: Clean up messy package metadata from the npm registry

Dev Dependencies

  • tap-spec: Formatted TAP output like Mocha's spec reporter
  • tape: tap-producing test harness for node and browsers

License

MIT

Generated by package-json-to-readme