diff options
author | Gar <gar+gh@danger.computer> | 2022-03-14 23:53:34 +0300 |
---|---|---|
committer | nlf <nlf@github.com> | 2022-03-15 23:38:37 +0300 |
commit | e26548fb12a3bb23fbe32a336f1305e083aa51c0 (patch) | |
tree | abc72b0d62357e79bb1d5626a553c9e4de85bb68 /node_modules/cacache/lib/verify.js | |
parent | f6b771aabece09dca2231426d4f681d3578e5ab7 (diff) |
deps: cacache@16.0.0
Diffstat (limited to 'node_modules/cacache/lib/verify.js')
-rw-r--r-- | node_modules/cacache/lib/verify.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/node_modules/cacache/lib/verify.js b/node_modules/cacache/lib/verify.js index e9d679ece..300cd9f9d 100644 --- a/node_modules/cacache/lib/verify.js +++ b/node_modules/cacache/lib/verify.js @@ -54,8 +54,9 @@ function verify (cache, opts) { stats[k] = s[k] }) const end = new Date() - if (!stats.runTime) + if (!stats.runTime) { stats.runTime = {} + } stats.runTime[label] = end - start return Promise.resolve(stats) @@ -108,8 +109,9 @@ function garbageCollect (cache, opts) { const indexStream = index.lsStream(cache) const liveContent = new Set() indexStream.on('data', (entry) => { - if (opts.filter && !opts.filter(entry)) + if (opts.filter && !opts.filter(entry)) { return + } liveContent.add(entry.integrity.toString()) }) @@ -176,8 +178,9 @@ function verifyContent (filepath, sri) { return ssri .checkStream(new fsm.ReadStream(filepath), sri) .catch((err) => { - if (err.code !== 'EINTEGRITY') + if (err.code !== 'EINTEGRITY') { throw err + } return rimraf(filepath).then(() => { contentInfo.valid = false @@ -186,8 +189,9 @@ function verifyContent (filepath, sri) { .then(() => contentInfo) }) .catch((err) => { - if (err.code === 'ENOENT') + if (err.code === 'ENOENT') { return { size: 0, valid: false } + } throw err }) @@ -209,9 +213,9 @@ function rebuildIndex (cache, opts) { const entry = entries[k] const excluded = opts.filter && !opts.filter(entry) excluded && stats.rejectedEntries++ - if (buckets[hashed] && !excluded) + if (buckets[hashed] && !excluded) { buckets[hashed].push(entry) - else if (buckets[hashed] && excluded) { + } else if (buckets[hashed] && excluded) { // skip } else if (excluded) { buckets[hashed] = [] |