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.
npm install npm-registry-cache --save
var registry = new RegistryCache([options]);
options
(Object)ttl
(Integer) Number of milliseconds until the cache should be rebuild. Default: 24 hoursfields
(Array or Function) List of the package fields to cache, eg title, description, author. Defaults: "name"
Simple Example
var RegistryCache = require('npm-registry-cache');
var registry = new RegistryCache();
var results = registry.get();
console.log(results.length);
Example with fields and ttl
var RegistryCache = require('npm-registry-cache');
var registry = new RegistryCache({
ttl: 1000*3600*24*7,
fields: ['name', 'version', 'homepage']
});
var results = registry.get();
console.log(results.length);