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