cacache
21.0.2 · 11 Nov 2026ISC44M / weekRepositoryHomepagenpmAtom feed
111 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 14.x
14.0.0
28 Jan 2020- Breaking
deps: bumps engines to >= 10
- Breaking
deps: tar v6 and mkdirp v1
- 13.x
13.0.1
30 Sep 201913.0.0
25 Sep 2019- Breaking
This subtly changes the streaming interface of everything in cacache that streams, which is, well, everything in cacache. Most users will probably not notice, but any code that depended on stream behavior always being deferred until next tick will need to adjust.
- Breaking
minipass The core stream library.
- Breaking
fs-minipass Note that the 'WriteStream' class from fs-minipass is not a Minipass stream, but rather a plain old EventEmitter that duck types as a Writable.
Breaking changes
- Breaking
This subtly changes the streaming interface of everything in cacache that streams, which is, well, everything in cacache. Most users will probably not notice, but any code that depended on stream behavior always being deferred until next tick will need to adjust.
The mississippi methods 'to', 'from', 'through', and so on, have been replaced with their Minipass counterparts, and streaming interaction with the file system is done via fs-minipass.
The following modules are of interest here:
- Breaking
minipass The core stream library.
- Breaking
fs-minipass Note that the 'WriteStream' class from fs-minipass is not a Minipass stream, but rather a plain old EventEmitter that duck types as a Writable.
- Breaking
minipass-collect Gather up all the data from a stream. Cacache only uses Collect.PassThrough, which is a basic Minipass passthrough stream which emits a 'collect' event with the completed data just before the 'end' event.
- Breaking
minipass-pipeline Connect one or more streams into a pipe chain. Errors anywhere in the pipeline are proxied down the chain and then up to the Pipeline object itself. Writes go into the head, reads go to the tail. Used in place of pump() and pumpify().
- Breaking
minipass-flush A Minipass passthrough stream that defers its 'end' event until after a flush() method has completed (either calling the supplied callback, or returning a promise.) Use in place of flush-write-stream (aka mississippi.to).
Streams from through2, concat-stream, and the behavior provided by end-of-stream are all implemented in Minipass itself.
Features of interest to cacache, which make Minipass a particularly good fit:
- Breaking
All of the 'endish' events are normalized, so we can just listen on 'end' and know that finish, prefinish, and close will be handled as well.
- Breaking
Minipass doesn't waste time containing zalgo.
- Breaking
Minipass has built-in support for promises that indicate the end or error: stream.promise(), stream.collect(), and stream.concat().
- Breaking
With reliable and consistent timing guarantees, much less error-checking logic is required. We can be more confident that an error is being thrown or emitted in the correct place, rather than in a callback which is deferred, resulting in a hung promise or uncaughtException.
The biggest downside of Minipass is that it lacks some of the internal characteristics of node-core streams, which many community modules use to identify streams. They have no _writableState or _readableState objects, or _read or _write methods. As a result, the is-stream module (at least, at the time of this commit) doesn't recognize Minipass streams as readable or writable streams.
All in all, the changes required of downstream users should be minimal, but are unlikely to be zero. Hence the semver major change.
Features
Replace all streams with Minipass streams
deps: Add minipass and minipass-pipeline
promise: converted .resolve to native promise, converted .map and .reduce to native
promise: individually promisifing functions as needed
promise: moved .reject from bluebird to native promise
promise: removed .fromNode, removed .join
promise: removed .map, replaced with p-map. removed .try
promise: removed .tap
promise: removed .using/.disposer
promise: removed bluebird
promise: removed bluebird specific .catch calls
promise: replaced .reduce and .mapSeries
- 12.x
12.0.1
19 Jul 2019deps Abstracted out
lib/util/infer-owner.jsto @npmcli/infer-owner so that it could be more easily used in other parts of the npm CLI.
12.0.0
15 Jul 2019- Breaking
The uid gid options are no longer respected or necessary. As of this change, cacache will always match the cache contents to the ownership of the cache directory (or its parent directory), regardless of what the caller passes in.
Infer uid/gid instead of accepting as options
i18n: add another error message
Features
Infer uid/gid instead of accepting as options
i18n: add another error message
Breaking changes
- Breaking
The uid gid options are no longer respected or necessary. As of this change, cacache will always match the cache contents to the ownership of the cache directory (or its parent directory), regardless of what the caller passes in.
Reasoning:
The number one reason to use a uid or gid option was to keep root-owned files from causing problems in the cache. In npm's case, this meant that CLI's ./lib/command.js had to work out the appropriate uid and gid, then pass it to the libnpmcommand module, which had to in turn pass the uid and gid to npm-registry-fetch, which then passed it to make-fetch-happen, which passed it to cacache. (For package fetching, pacote would be in that mix as well.)
Added to that,
cacache.rm()will actually write a file into the cache index, but has no way to accept an option so that its call to entry-index.js will write the index with the appropriate uid/gid. Little ownership bugs were all over the place, and tricky to trace through. (Why should make-fetch-happen even care about accepting or passing uids and gids? It's an http library.)This change allows us to keep the cache from having mixed ownership in any situation.
Of course, this does mean that if you have a root-owned but user-writable folder (for example,
/tmp), then the cache will try to chown everything to root.The solution is for the user to create a folder, make it user-owned, and use that, rather than relying on cacache to create the root cache folder.
If we decide to restore the uid/gid opts, and use ownership inference only when uid/gid are unset, then take care to also make rm take an option object, and pass it through to entry-index.js.
- 11.x
11.3.3
17 Jun 201911.3.2
21 Dec 2018get: make sure to handle errors in the .then
11.3.1
5 Nov 2018get: export hasContent.sync properly
11.3.0
5 Nov 2018get: add sync API for reading
11.2.0
8 Aug 2018read: add sync support to other internal read.js fns
11.1.0
1 Aug 2018read: add sync support for low-level content read
11.0.3
1 Aug 2018config: add ssri config options
perf: refactor content.read to avoid lstats
Bug Fixes
config: add ssri config options
perf: refactor content.read to avoid lstats
11.0.1
10 Apr 201811.0.0
9 Apr 2018- Removed
Drop support for node@4
- Breaking
node@4 is no longer supported
opts: use figgy-pudding for opts
- 10.x
10.0.4
16 Feb 201810.0.3
16 Feb 2018content: rethrow aggregate errors as ENOENT
10.0.2
7 Jan 2018ls: deleted entries could cause a premature stream EOF
10.0.1
15 Nov 2017move-file: actually use the fallback to
move-concurrently
10.0.0
23 Oct 2017- Breaking
license: the license has been changed from CC0-1.0 to ISC.
license: relicense to ISC
More copyFile benchmarks
- 9.x
9.3.0
7 Oct 2017copy: added cacache.get.copy api for fast copies
9.2.9
17 Jun 20179.2.8
5 Jun 2017ssri: bump ssri for bugfix
9.2.7
5 Jun 2017content: make verified content completely read-only
9.2.6
31 May 2017node: update ssri to prevent old node 4 crash
9.2.5
25 May 2017deps: fix lockfile issues and bump ssri
9.2.4
24 May 2017deps: bumping deps
9.2.3
24 May 2017rm: stop crashing if content is missing on rm
9.2.2
14 May 2017i18n: lets pretend this didn't happen
9.2.1
14 May 2017Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.
9.2.0
14 May 2017i18n: add Spanish translation for API
9.1.0
14 May 2017i18n: Add Spanish translation and i18n setup
9.0.0
28 Apr 2017- Breaking
memoization: If you were passing an object to opts.memoize, it will now be used as an injected memoization object. If you were only passing booleans and other non-objects through that option, no changes are needed.
memoization: actually use the LRU
memoization: memoizers can be injected through opts.memoize
- 8.x
- 7.x
7.1.0
20 Apr 2017size: handle content size info
7.0.5
18 Apr 2017integrity: new ssri with fixed integrity stream
write: wrap stuff in promises to improve errors
7.0.4
15 Apr 2017fix-owner: throw away ENOENTs on chownr
7.0.3
5 Apr 2017read: fixing error message for integrity verification failures
7.0.2
3 Apr 2017integrity: use EINTEGRITY error code and update ssri
7.0.1
3 Apr 2017Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.
7.0.0
3 Apr 2017- Breaking
integrity: The entire API has been overhauled to use SRI hashes instead of digest/hashAlgorithm pairs. SRI hashes follow the Subresource Integrity standard and support strings and objects compatible with
ssri. - Breaking
This change bumps the index version, which will invalidate all previous index entries. Content entries will remain intact, and existing caches will automatically reuse any content from before this breaking change.
- Breaking
cacache.get.info(),cacache.ls(), andcacache.ls.stream()will now return objects that looks like this:
Features
integrity: subresource integrity support
Breaking changes
- Breaking
integrity: The entire API has been overhauled to use SRI hashes instead of digest/hashAlgorithm pairs. SRI hashes follow the Subresource Integrity standard and support strings and objects compatible with
ssri. - Breaking
This change bumps the index version, which will invalidate all previous index entries. Content entries will remain intact, and existing caches will automatically reuse any content from before this breaking change.
- Breaking
cacache.get.info(),cacache.ls(), andcacache.ls.stream()will now return objects that looks like this:
{ key: String, integrity: '<algorithm>-<base64hash>', path: ContentPath, time: Date<ms>, metadata: Any }- Breaking
opts.digestandopts.hashAlgorithmare obsolete for any API calls that used them. - Breaking
Anywhere
opts.digestwas accepted,opts.integrityis now an option. Any valid SRI hash is accepted here -- multiple hash entries will be resolved according to the standard: first, the "strongest" hash algorithm will be picked, and then each of the entries for that algorithm will be matched against the content. Content will be validated if any of the entries match (so, a single integrity string can be used for multiple "versions" of the same document/data). - Breaking
put.byDigest(),put.stream.byDigest,get.byDigest()andget.stream.byDigest()now expect an SRI instead of adigest+opts.hashAlgorithmpairing. - Breaking
get.hasContent()now expects an integrity hash instead of a digest. If content exists, it will return the specific single integrity hash that was found in the cache. - Breaking
verify()has learned to handle integrity-based caches, and forgotten how to handle old-style cache indices due to the format change. - Breaking
cacache.rm.content()now expects an integrity hash instead of a hex digest.
- 6.x
6.3.0
1 Apr 2017fixOwner: ignore EEXIST race condition from mkdirp
index: ignore index removal races when inserting
memo: use lru-cache for better mem management
Bug Fixes
fixOwner: ignore EEXIST race condition from mkdirp
index: ignore index removal races when inserting
memo: use lru-cache for better mem management
Features
dependencies: Switch to move-concurrently
6.2.0
15 Mar 2017index: additional bucket entry verification with checksum
verify: return fixOwner.chownr promise
tmp: safe tmp dir creation/management util
6.1.2
13 Mar 2017index: set default hashAlgorithm
6.1.1
13 Mar 2017coverage: bumping coverage for verify
deps: glob should have been a regular dep :<
6.1.0
12 Mar 2017coverage: more coverage for content reads
verify: tested, working cache verifier/gc
6.0.2
11 Mar 2017index: segment cache items with another subbucket
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.