UNPKG

558 BMarkdownView Raw
1# npm-cache-filename
2
3Given a cache folder and url, return the appropriate cache folder.
4
5## USAGE
6
7```javascript
8var cf = require('npm-cache-filename');
9console.log(cf('/tmp/cache', 'https://registry.npmjs.org:1234/foo/bar'));
10// outputs: /tmp/cache/registry.npmjs.org_1234/foo/bar
11```
12
13As a bonus, you can also bind it to a specific root path:
14
15```javascript
16var cf = require('npm-cache-filename');
17var getFile = cf('/tmp/cache');
18
19console.log(getFile('https://registry.npmjs.org:1234/foo/bar'));
20// outputs: /tmp/cache/registry.npmjs.org_1234/foo/bar
21```