npm-registry-cache

0.5.3 • Public • Published

npm-registry-cache

Simple cache of the entire npm registry. Choose which fields per package to cache (eg. name and author), and how often the cache should be rebuilt.

Installation

npm install npm-registry-cache --save

Usage

var registry = new RegistryCache([options]);
  • options (Object)
    • ttl (Integer) Number of milliseconds until the cache should be rebuild. Default: 24 hours
    • fields (Array or Function) List of the package fields to cache, eg title, description, author. Defaults: "name"

Simple Example

var RegistryCache = require('registry-cache');
var registry = new RegistryCache();
 
var results = registry.get();
console.log(results.length);

Example with fields and ttl

var RegistryCache = require('registry-cache');
var registry = new RegistryCache({
    ttl: 1000*3600*24*7,
    fields: ['name', 'version', 'homepage']
});
 
var results = registry.get();
console.log(results.length);

Package Sidebar

Install

npm i npm-registry-cache

Weekly Downloads

1

Version

0.5.3

License

ISC

Last publish

Collaborators

  • sqren