How to use the cacache.verify function in cacache

To help you get started, we’ve selected a few cacache examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github graalvm / graaljs / deps / npm / lib / cache.js View on Github external
function verify () {
  const cache = path.join(npm.config.get('cache'), '_cacache')
  let prefix = cache
  if (prefix.indexOf(process.env.HOME) === 0) {
    prefix = '~' + prefix.substr(process.env.HOME.length)
  }
  return cacache.verify(cache).then((stats) => {
    output(`Cache verified and compressed (${prefix}):`)
    output(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`)
    stats.badContentCount && output(`Corrupted content removed: ${stats.badContentCount}`)
    stats.reclaimedCount && output(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
    stats.missingContent && output(`Missing content: ${stats.missingContent}`)
    output(`Index entries: ${stats.totalEntries}`)
    output(`Finished in ${stats.runTime.total / 1000}s`)
  })
}
github skypager / skypager / src / features / file-manager / src / file-manager.js View on Github external
'.cache',
      'skypager-cache'
    )

  const {
    fileManagerCachePath,
    skypagerCachePath = fileManagerCachePath || defaultCachePath,
  } = options

  const arg = fn => partial(fn, this.runtime.resolve(skypagerCachePath))

  const ls = arg(cacache.ls)
  const get = arg(cacache.get)
  const put = arg(cacache.put)
  const rm = arg(cacache.rm)
  const verify = arg(cacache.verify)

  return {
    ...cacache,
    cachePath: skypagerCachePath,
    ls: Object.assign(ls, {
      stream: arg(cacache.ls.stream),
    }),
    get: Object.assign(get, {
      stream: arg(cacache.get.stream),
      byDigest: arg(cacache.get.byDigest),
      copy: arg(cacache.get.copy),
      info: arg(cacache.get.info),
      hasContent: arg(cacache.get.hasContent),
    }),
    put: Object.assign(put, {
      stream: arg(cacache.put.stream),
github skypager / skypager / src / features / file-manager / src / file-manager.js View on Github external
hasContent: arg(cacache.get.hasContent),
    }),
    put: Object.assign(put, {
      stream: arg(cacache.put.stream),
    }),
    rm: Object.assign(rm, {
      all: arg(cacache.rm.all),
      entry: arg(cacache.rm.entry),
      content: arg(cacache.rm.content),
    }),
    tmp: {
      mkdir: arg(cacache.tmp.mkdir),
      withTmp: arg(cacache.tmp.withTmp),
    },
    verify: Object.assign(verify, {
      lastRun: arg(cacache.verify.lastRun),
    }),
  }
}