Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 3, 2024 via pnpm

cacache 16.0.2

Fast, fault-tolerant, cross-platform, disk-based, data-agnostic, content-addressable cache.
Package summary
Share
4
issues
1
high severity
meta
1
3
moderate severity
meta
3
2
licenses
27
ISC
13
MIT
Package created
18 Nov 2016
Version published
17 Mar 2022
Maintainers
5
Total deps
40
Direct deps
18
License
ISC

Issues

4

1 high severity issue

high
via: @npmcli/move-file@1.1.2
Collapse
Expand

3 moderate severity issues

moderate
via: @npmcli/fs@1.1.1
via: minipass-collect@1.0.2
via: minipass-pipeline@1.2.4
Collapse
Expand

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
27 Packages, Including:
@npmcli/fs@1.1.1
cacache@16.0.2
chownr@2.0.0
fs-minipass@2.1.0
fs.realpath@1.0.0
glob@7.2.3
infer-owner@1.0.4
inflight@1.0.6
inherits@2.0.4
lru-cache@6.0.0
lru-cache@7.18.3
minimatch@3.1.2
minipass-collect@1.0.2
minipass-flush@1.0.5
minipass-pipeline@1.2.4
minipass@3.3.6
minipass@5.0.0
once@1.4.0
promise-inflight@1.0.1
rimraf@3.0.2
semver@7.6.0
ssri@8.0.1
tar@6.2.1
unique-filename@1.1.1
unique-slug@2.0.2
wrappy@1.0.2
yallist@4.0.0

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
13 Packages, Including:
@gar/promisify@1.1.3
@npmcli/move-file@1.1.2
aggregate-error@3.1.0
balanced-match@1.0.2
brace-expansion@1.1.11
clean-stack@2.2.0
concat-map@0.0.1
imurmurhash@0.1.4
indent-string@4.0.0
minizlib@2.1.2
mkdirp@1.0.4
p-map@4.0.0
path-is-absolute@1.0.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

18
All Dependencies CSV
β“˜ This is a list of cacache 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@npmcli/fs1.1.112.24 kBISC
prod
1
@npmcli/move-file1.1.22.85 kBMIT
prod
1
chownr2.0.02.19 kBISC
prod
fs-minipass2.1.04.43 kBISC
prod
glob7.2.315.08 kBISC
prod
infer-owner1.0.42.01 kBISC
prod
lru-cache7.18.334.41 kBISC
prod
minipass-collect1.0.22.01 kBISC
prod
1
minipass-flush1.0.51.93 kBISC
prod
minipass-pipeline1.2.42.93 kBISC
prod
1
minipass3.3.614.98 kBISC
prod
mkdirp1.0.46.51 kBMIT
prod
p-map4.0.03.36 kBMIT
prod
promise-inflight1.0.11.63 kBISC
prod
rimraf3.0.26.33 kBISC
prod
ssri8.0.113.76 kBISC
prod
tar6.2.1162.71 kBISC
prod
unique-filename1.1.113.26 kBISC
prod

Visualizations

Frequently Asked Questions

What does cacache do?

Cacache is a powerful JavaScript library that manages local key and content address caches. It is known for its speed, excellent concurrency handling, and fault tolerance that ensures data integrity even if cache files get corrupted or manipulated. Cacache maintains consistent read and write operations, provides automatic content deduplication, and supports multi-hash storage, enabling appropriate management of sha1, sha512, etc., in a single cache. It is designed with a streaming support feature for efficient data handling and also provides utility functions for managing cache directories along with offline verification and garbage collection for maintaining cache efficiency. Cacache was originally developed as npm's local cache but its functionality makes it easy to use as an independent caching solution.

How do you use cacache?

To use Cacache, you first need to install it using npm by running $ npm install --save cacache. After installing, you can require it in your program and use it to read or write cache data. Here are a few examples:

To write data to a cache, you can use cacache's put method as follows:

const cacache = require('cacache')
const cachePath = '/tmp/my-toy-cache'
const key = 'my-unique-key-1234'

cacache.put(cachePath, key, '10293801983029384').then(integrity => {
  console.log(`Saved content to ${cachePath}.`)
})

In this example '10293801983029384' is the content being saved in the cache, under the 'cachePath' directory with 'my-unique-key-1234' as the key.

To read data from a cache, cacache provides get and get.stream methods:

const fs = require('fs')

const destination = '/tmp/mytar.tgz'

// Read the contents out of the cache and into their destination
cacache.get.stream(
  cachePath, key
).pipe(
  fs.createWriteStream(destination)
).on('finish', () => {
  console.log('done extracting!')
})

const integrityHash = 'sha512-BaSe64/EnCoDED+HAsh=='

// The same thing, but skip the key index.
cacache.get.byDigest(cachePath, integrityHash).then(data => {
  fs.writeFile(destination, data, err => {
    console.log('tarball data fetched based on its sha512sum and written out!')
  })
})

In these examples, data corresponding to a certain key or a content integrity hash is being extracted from the cache and written to a file.

Where are the cacache docs?

The primary source of information on how to use cacache is the documentation provided in the Readme file on its GitHub page: git+https://github.com/npm/cacache.git. You can find detailed instructions on how to install and use the library, code examples, a comprehensive list of API endpoints and methods, descriptions of important features, and insights into how cacache manages the cache. The Readme also includes guidance on how to contribute to the project and its code of conduct.