2.0.0-3 • Published 5 years ago

npcache v2.0.0-3

Weekly downloads
256
License
ISC
Repository
github
Last release
5 years ago

npcache

npm version Build Status Coverage Status

Manipulate cache of npm packages

const npcache = require('npcache');

(async () => {
  const cache = await npcache.get('make-fetch-happen:request-cache:https://registry.npmjs.org/glob');

  cache.metadata; //=> {url: 'https://registry.npmjs.org/glob', ...}
  cache.data; //=> <Buffer 7b 22 76 65 72 73 69 6f 6e 73 22 3a 7b 22 ...>
  cache.size; //=> 37086  
  cache.integrity; //=> 'sha512-Non1RHdlmK+8lJaN1a88N ...'
})();

Installation

Use npm.

npm install npcache

API

const npcache = require('npcache');

npcache

The API is based on cacache, a cache manipulation library used inside npm CLI.

Note the following differences:

(async () => {
  for await (const {path} of npcache.ls.stream()) {
    console.log(path);
  }
})();
/Users/shinnn/.npm/_cacache/content-v2/sha512/a6/12/5f41506e689339ada ...
/Users/shinnn/.npm/_cacache/content-v2/sha512/ff/1a/f50039b96e74e38cd ...
/Users/shinnn/.npm/_cacache/content-v2/sha512/0b/61/241d7c17bcbb1baee ...
/Users/shinnn/.npm/_cacache/content-v2/sha512/39/a5/358478e025ff9bd0d ...
...

License

ISC License © 2018 - 2019 Watanabe Shinnosuke