Socket
Socket
Sign inDemoInstall

all-the-packages

Package Overview
Dependencies
10
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    all-the-packages

All the npm registry metadata as an offline event stream.


Version published
Weekly downloads
12
increased by140%
Maintainers
1
Install size
556 kB
Created
Weekly downloads
 

Readme

Source

all-the-packages

All the npm registry metadata as an offline event stream.

Why?

See https://github.com/nice-registry/about#why

Installation

npm install all-the-packages --save

When you install this package, a postinstall script downloads the npm registry metadata to a local JSON file, which is about 540 MB.

To refresh the module once you've already installed it, just reinstall:

npm i all-the-packages@latest

Usage

This package provides a simple event emitter that emits two events: package and end.

const registry = require('all-the-packages')

registry
  .on('package', function (pkg) {
    console.log(`${pkg.name} - ${pkg.description}\n`)
  })
  .on('end', function () {
    // done
  })

To get cleaner package data, use nice-package:

const registry = require('all-the-packages')
const NicePackage = require('nice-package')
const coolPackages = []

registry
  .on('package', function (pkg) {
    if (pkg.name.match('cool') || pkg.description.match('cool')) {
      coolPackages.push(new NicePackage(pkg))
    }
  })
  .on('end', function () {
    // done
  })

Why Streams?

Streams are cool and all, but the main reason this module has a streaming interface is RAM. It would be nice to just require the module and have a giant registry object to work with, but a 400 MB JSON file is too big to fit in memory on most computers.

See Also

  • package-stream: An endless stream of clean package data from the npm registry.
  • nice-package: Clean up messy package metadata from the npm registry

Tests

npm install
npm test

Dependencies

  • JSONStream: rawStream.pipe(JSONStream.parse()).pipe(streamOfObjects)
  • event-stream: construct pipes of streams of events

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

Keywords

FAQs

Last updated on 25 Jan 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc