Packages

cacache

21.0.2 · 11 Nov 2026ISC44M / weekRepositoryHomepagenpmAtom feed

Your version

13.0.0

major25 Sep 2019Where it was published

13.0.1 is the newest release of 13.x.

In short

10 breaking12 new

  • 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

    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).

  • 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.

Release note

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

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.