cacache is a Node.js library for managing local key and content address caches. It is fast, fault-tolerant, cross-platform, and guarantees no corrupted data even if cache files are manipulated. Current stable version is 21.0.0 (requires Node ^22.22.2 || ^24.15.0 || >=26.0.0). It supports Subresource Integrity, automatic deduplication, streaming, and concurrency without locks. Used as npm's local cache but can be used standalone. Differentiators include performance, fault tolerance, and multi-hash support.
npm install cacacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic put/get operations with the cache, returning integrity hash.
Upgrade Node to ^22.22.2 || ^24.15.0 || >=26.0.0
Ensure the target path is a directory (use mkdirp if necessary).
Always convert keys to strings (e.g., key.toString()).
Use your own temporary file utilities (e.g., tmp-promise).
Ensure the directory exists: `mkdir -p /tmp/my-cache` or use fs.mkdirSync with recursive: true.
Provide a valid string path as the first argument.
Use cacache.verify() to clean up corrupted entries, or delete the cache directory and start fresh.
No dependency data recorded yet.