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

cacheify

v0.4.2

Published

Wraps browserify transforms in a caching stream.

Readme

Cacheify

Cacheify is a caching layer for browserify transforms. You specify a transform and a cache and it handles the rest by wrapping everything in its own browserify transform that you'll pass to the bundling process.

You can also specify custom filter and hash functions to be specific about which files get cached, and how a file is decided to be unique.

Example usage

var cacheify = require('cacheify')
  , coffeeify = require('coffeeify')
  , level = require('level')
  , db = level('./cache');

...

var cachingCoffeeify = cacheify(coffeeify, db)

...

b.transform(cachingCoffeeify)

API

cacheify(transform, db)

Creates a new cacheify transform.

  • transform: The transform you want to cache the output of
  • db: A levelup-api compatible database object, or a function that returns such an object. This is where the results of cached transforms are stored.
cacheify.filter(fn)

Replaces the default filter function (always returns true) with a function of your choosing. The filter function is called per file and if it returns a truthy value we will cache the results of the transform of the file, or read from the cache if it's already there. If it returns false we will apply the original transform without caching.

  • fn: The filter function you want to use. It takes one argument, the file path. If fn is a RegExp object, cacheify.filter will wrap it in a function that tests each filename against it.
cacheify.hash(fn)

Replaces the default hash function (md5 of the file's contents) with a function of your choosing. The hash function will be used to generate a unique key for a file, that we will check to see if it exists in the DB before applying the original transform.

  • fn: The hash function you want to use. It takes two arguments, the file contents and the file path.

Changelog

  • 0.4.2 Updates concat-stream to remove a security vulneratbility. Thanks for @puzrin for the report (#11).

  • 0.4.0 Now passes transform options through to cachee streams.

  • 0.3.2 Now handles multiple errors in the cachee stream instead of only one.

  • 0.3.1 the second argument, db, can now be a function that returns a db. Useful if you need to close connections and unlock the leveldb between bundles.

  • 0.2.1: When the filter returns false, instead of passing an empty through pass the original uncached transform. That way it can handle what gets transformed and we only handle what gets cached.

  • 0.2.0: Do not use, has breaking bugs!! 0.2.1 fixes them. Apologies!

    • Changed the API significantly.
    • Added the ability to specify a filter function to be selective about which files are transformed.
    • Because hash is optional like filter, changed how you apply a custom hash function to be similar to how you apply a custom filter function.
    • Changed the order of arguments to cacheify, it takes the transform first and the db second
    • The db argument can now be a function instead of an object. If it is, it will call that function to get the db object. This gives you more flexibility when working in environments with complicated locking orders on the dbs.

License

BSD, see the LICENSE.md for more information.