How to use the cacache.get.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 / pkglock.js View on Github external
function getPkg (cache, scope, pkgName) {
  const key = depKey(pkgName, scope.dependencies[pkgName])
  if (pkgCache.has(key)) {
    return pkgCache.get(key)
  } else {
    const tink = process.tink
    process.tink = null
    try {
      const { metadata } = ccGet.sync(cache, key)
      const ret = JSON.parse(metadata)
      pkgCache.set(key, ret)
      return ret
    } finally {
      process.tink = tink
    }
  }
}