Comparing version 6.0.0 to 6.0.1
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="6.0.1"></a> | ||
## [6.0.1](https://github.com/zkat/cacache/compare/v6.0.0...v6.0.1) (2017-03-05) | ||
### Bug Fixes | ||
* **docs:** Missed spots in README ([8ffb7fa](https://github.com/zkat/cacache/commit/8ffb7fa)) | ||
<a name="6.0.0"></a> | ||
@@ -7,0 +17,0 @@ # [6.0.0](https://github.com/zkat/cacache/compare/v5.0.3...v6.0.0) (2017-03-05) |
{ | ||
"name": "cacache", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"cache-version": { | ||
@@ -5,0 +5,0 @@ "content": "1", |
# cacache [![npm version](https://img.shields.io/npm/v/cacache.svg)](https://npm.im/cacache) [![license](https://img.shields.io/npm/l/cacache.svg)](https://npm.im/cacache) [![Travis](https://img.shields.io/travis/zkat/cacache.svg)](https://travis-ci.org/zkat/cacache) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/cacache?svg=true)](https://ci.appveyor.com/project/zkat/cacache) [![Coverage Status](https://coveralls.io/repos/github/zkat/cacache/badge.svg?branch=latest)](https://coveralls.io/github/zkat/cacache?branch=latest) | ||
[`cacache`](https://github.com/zkat/cacache) is a Node.js library for managing | ||
caches of keyed data that can be looked up both by key and by a digest of the | ||
content itself. This means that by-content lookups can be very very fast, and | ||
that stored content is shared by different keys if they point to the same data. | ||
local key and content address caches. It's really fast, really good at | ||
concurrency, and it will never give you corrupted data, even if cache files | ||
get corrupted or manipulated. | ||
It was originally written to be used as [npm](https://npm.im)'s local cache, but | ||
can just as easily be used on its own | ||
## Install | ||
@@ -44,10 +47,4 @@ | ||
// Cache it! Use `cachePath` as the root of the content cache | ||
fs.createReadStream( | ||
tarball | ||
).pipe( | ||
cacache.put.stream( | ||
cachePath, key | ||
).on('digest', (d) => tarballDigest = d) | ||
).on('finish', function () { | ||
console.log(`Saved ${tarball} to ${cachePath}.`) | ||
cacache.put(cachePath, key, '10293801983029384').then(digest => { | ||
console.log(`Saved content to ${cachePath}.`) | ||
}) | ||
@@ -58,2 +55,3 @@ | ||
// Copy the contents out of the cache and into their destination! | ||
// But this time, use stream instead! | ||
cacache.get.stream( | ||
@@ -68,8 +66,6 @@ cachePath, key | ||
// The same thing, but skip the key index. | ||
cacache.get.stream.byDigest( | ||
cachePath, tarballDigest | ||
).pipe( | ||
fs.createWriteStream(destination) | ||
).on('finish', () => { | ||
console.log('done extracting using sha1!') | ||
cacache.get.byDigest(cachePath, tarballSha512).then(data => { | ||
fs.writeFile(destination, data, err => { | ||
console.log('tarball data fetched based on its sha512sum and written out!') | ||
}) | ||
}) | ||
@@ -80,8 +76,11 @@ ``` | ||
* Extraction by key or by content digest (shasum, etc). | ||
* Deduplicated content by digest -- two inputs with same key are only saved once | ||
* Consistency checks, both on insert and extract. | ||
* (Kinda) concurrency-safe and fault tolerant. | ||
* Streaming support. | ||
* Metadata storage. | ||
* Extraction by key or by content address (shasum, etc) | ||
* Multi-hash support - safely host sha1, sha512, etc, in a single cache | ||
* Automatic content deduplication | ||
* Fault tolerance and consistency guarantees for both insertion and extraction | ||
* Lockless, high-concurrency cache access | ||
* Streaming support | ||
* Promise support | ||
* Arbitrary metadata storage | ||
* Garbage collection and additional offline verification | ||
@@ -109,3 +108,4 @@ ### Contributing | ||
digest: 'deadbeef', | ||
path: '.testcache/content/deadbeef', | ||
hashAlgorithm: 'sha512', | ||
path: '.testcache/content/deadbeef', // joined with `cachePath` | ||
time: 12345698490, | ||
@@ -121,2 +121,3 @@ metadata: { | ||
digest: 'bada55', | ||
hashAlgorithm: 'whirlpool', | ||
path: '.testcache/content/bada55', | ||
@@ -128,3 +129,3 @@ time: 11992309289 | ||
#### <a name="get-data"></a> `> cacache.get(cache, key, [opts]) -> Promise({data, metadata, digest})` | ||
#### <a name="get-data"></a> `> cacache.get(cache, key, [opts]) -> Promise({data, metadata, digest, hashAlgorithm})` | ||
@@ -134,3 +135,5 @@ Returns an object with the cached data, digest, and metadata identified by | ||
presumably holds some data that means something to you. I'm sure you know what | ||
to do with it! cacache just won't care. | ||
to do with it! cacache just won't care. `hashAlgorithm` is the algorithm used | ||
to calculate the `digest` of the content. This algorithm must be used if you | ||
fetch later with `get.byDigest`. | ||
@@ -261,5 +264,3 @@ If there is no content identified by `key`, or if the locally-stored data does | ||
).then(data => { | ||
cacache.put( | ||
cachePath, 'registry.npmjs.org|cacache@1.0.0', data | ||
) | ||
return cacache.put(cachePath, 'registry.npmjs.org|cacache@1.0.0', data) | ||
}).then(digest => { | ||
@@ -266,0 +267,0 @@ console.log('digest is', digest) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
50460
430
0