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

pkgcache

v0.7.1

Published

cache dependency manager for npm, bower, and composer

Downloads

31

Readme

pkgcache

pkgcache is a command line utility that caches dependencies installed via npm, bower, and composer.

npm install -g pkgcache

Summary

pkgcache can be a drop-in replacement for any build script that runs [npm|bower|composer] install.

It is useful for build processes that run [npm|bower|composer] install every time as part of their build process. Since dependencies don't change often, this often means slower build times. pkgcache helps alleviate this problem by caching previously installed dependencies on the build machine.

How It Works

  1. When you run pkgcache install [npm|bower|composer], it first looks for package.json, bower.json, or composer.json in the current working directory depending on which dependency manager is requested.
  2. It then calculates the MD5 hash of the configuration file and looks for a filed named .tar.gz in the cache directory ($HOME/.pkgcache/ by default).
  3. If the file does not exist, pkgcache uses the system's installed dependency manager to install the dependencies.
  4. Once the dependencies are installed, pkgcache tars the newly downloaded dependencies and stores them in the cache directory.
  5. If S3 is enabled via .pkgcache.json, the tarball is uploaded.
  6. The next time pkgcache runs and sees the same config file [hash calculation], it will find the tarball in the cache directory and untar the dependencies in the current working directory.
  7. If it’s unavailable in $HOME/.pkgcache/ and S3 is enabled, attempt to download it from S3.

How pkgcache Differs from the Original npm-cache

  1. The package cache directory structure includes the OS name and node version (if relaying npm).
  2. The dependencies and devDependencies are sorted before calculating a hash so the order does not effect the hash.
  3. Optionally use AWS S3 to share your cache among developers and continuous intergration. Put a .pkgcache.json in your project directory. E.g.:
{
  "accessKeyId": "...",
  "secretAccessKey": "...",
  "bucketName": "..."
}

Usage

pkgcache install

To specify arguments to each dependency manager, add the arguments after listing the dependency manager.

For example, to install bower components with the --allow-root option, and composer with the --dry-run option:

pkgcache install bower --allow-root composer --dry-run

Examples

Install npm, bower, and composer components simultaneously.

pkgcache install

Install only bower components.

pkgcache install bower

Install bower and npm components.

pkgcache install bower npm

Install bower with --allow-root and composer with --dry-run.

pkgcache install bower --allow-root composer --dry-run

Install bower components using /home/cache as the cache directory.

pkgcache install --cacheDirectory /home/cache/ bower

Force refresh a bower installation.

pkgcache install --forceRefresh bower

Clear the entire local $HOME/.pkgcache/ directory.

pkgcache clean

Cache Directory Structure

An example of how the tarballs are organized.

~/.pkgcache/
├── bower
│   └── project-one
│       └── 1.6.8
│           └── 7fed9e4deb7eba0c6686ac5d56c5561a.tar.gz
│           └── 7fed9e4deb7eba0c6686ac5d56c5561a.json
└── npm
    ├── project-one
    │   └── OS-X-Mavericks
    │       └── node-v0.12.7
    │           └── npm-2.11.3
    │               └── 5ea97f7c280ad42d0eefd50d03ed120e.tar.gz
    │               └── 5ea97f7c280ad42d0eefd50d03ed120e.json
    └── project-two
        └── OS-X-Mavericks
            ├── node-v0.12.7
            │   └── npm-2.11.3
            │       └── 38b13ac506b229325aa7207e601c11d5.tar.gz
            │       └── 38b13ac506b229325aa7207e601c11d5.json
            └── node-v4.2.3
                └── npm-3.5.2
                    └── 38b13ac506b229325aa7207e601c11d5.tar.gz
                    └── 38b13ac506b229325aa7207e601c11d5.json

Managing Archives

Local Archives

A meta file accompanies each tarball that contains the following information:

  • packageVersion is the version number from the config file
  • hash matches the filename hash
  • origin - whether the archive was created by internet installation or s3
  • date - when the archive was built
  • size - file size in human readable format
  • definition - the source for the hash

Example:

{
  "packageVersion": "1.1.0",
  "hash": "5d3129a53232e136103bad41da0544ac",
  "origin": "internet",
  "date": "2015-12-31T17:28:46-05:00",
  "size": "2.44MB",
  "definition": {
    "dependencies": {
      "moment": "^2.10.3",
      "serve-static": "^1.10.0",
      "express": "4.13.0"
    },
    "devDependencies": {
      "gulp": "^3.9.0",
      "del": "^2.2.0"
    }
  }
}

S3 Archives

S3 archives are managed manually. I.e. if you need to clear out a faulty tarball you must use the AWS interface.