How to use the cacache/lib/content/read.js.sync 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 npm / tink / lib / pkgmap.js View on Github external
function readSync ({ cache, hash, pkg, resolvedPath, isFile }) {
  if (!cache || !hash || !isFile) {
    throw new Error('readSync() requires a fully-resolved pkgmap file address')
  }
  try {
    return ccRead.sync(cache, hash)
  } catch (err) {
    const newResolved = repairPackageSync({ cache, hash, pkg, resolvedPath })
    cache = newResolved.cache
    hash = newResolved.hash
    pkg = newResolved.pkg
    return ccRead.sync(cache, hash)
  }
}
github npm / tink / lib / pkgmap.js View on Github external
function readSync ({ cache, hash, pkg, resolvedPath, isFile }) {
  if (!cache || !hash || !isFile) {
    throw new Error('readSync() requires a fully-resolved pkgmap file address')
  }
  try {
    return ccRead.sync(cache, hash)
  } catch (err) {
    const newResolved = repairPackageSync({ cache, hash, pkg, resolvedPath })
    cache = newResolved.cache
    hash = newResolved.hash
    pkg = newResolved.pkg
    return ccRead.sync(cache, hash)
  }
}