How to use the cacache.ls 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 / pacote / test / prefetch.js View on Github external
return prefetch('foo@1.0.0', OPTS).then(info => {
      t.deepEqual(info, {
        byDigest: false,
        integrity: BASE._integrity,
        manifest: BASE,
        spec: npa('foo@1.0.0')
      }, 'fresh fetch info returned')
      t.equal(srv.isDone(), true)
      return cacache.ls(CACHE)
    }).then(result => {
      t.equal(Object.keys(result).length, 2)
github npm / pacote / test / finalize-manifest.js View on Github external
return finalizeManifest(base, npa(base.name), opts).then(manifest1 => {
      base._integrity = manifest1._integrity
      return cacache.ls(CACHE, opts).then(entries => {
        Object.keys(entries).forEach(k => {
          if (k.match(/^pacote:.*-manifest/)) {
            t.ok(true, 'manifest entry exists in cache: ' + k)
          }
        })
      }).then(() => {
        return finalizeManifest(base, npa(base.name), opts)
      }).then(manifest2 => {
        t.deepEqual(manifest2, manifest1, 'got cached manifest')
      })
    })
  })
github npm / pacote / test / tarball.js View on Github external
return getStream.buffer(tarball.stream('foo@1.0.0', OPTS)).then(data => {
      t.equal(srv.isDone(), true, 'no pending requests')
      t.deepEqual(data, tarData, 'fetched tarball data matched')
      return cacache.ls(CACHE)
    }).then(result => {
      t.equal(Object.keys(result).length, 2, 'keys added to cache')
github skypager / skypager / src / features / file-manager / src / file-manager.js View on Github external
process.env.FILE_MANAGER_CACHE_PATH ||
    runtime.resolve(
      isEmpty(gitInfo.root) ? gitInfo.root : runtime.cwd,
      'node_modules',
      '.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),
github skypager / skypager / src / features / file-manager / src / file-manager.js View on Github external
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),
    }),
    rm: Object.assign(rm, {
      all: arg(cacache.rm.all),
      entry: arg(cacache.rm.entry),
      content: arg(cacache.rm.content),
    }),