0.5.3 • Published 8 years ago

npm-registry-cache v0.5.3

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

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);