Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
LICENSE | D | 12-May-2024 | 756 | 16 | 12 | |
README.md | D | 12-May-2024 | 558 | 22 | 15 | |
index.js | D | 12-May-2024 | 661 | 25 | 18 | |
package.json | D | 12-May-2024 | 1.4 KiB | 56 | 55 | |
test.js | D | 12-May-2024 | 873 | 24 | 20 |
README.md
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``` 22