Skip to content

List the package names for every module in the npm registry

License

Notifications You must be signed in to change notification settings

sorenlouv/npm-registry-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

List the package names for every module in the npm registry

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published