Skip to content
This repository was archived by the owner on Jul 3, 2019. It is now read-only.
This repository was archived by the owner on Jul 3, 2019. It is now read-only.

cacache.get.info returning path including cache dir, not relative path #165

Closed
@hdgarrood

Description

@hdgarrood

The documentation for cacache.get.info says that the path property in the returned object will contain the filesystem path relative to the cache argument where content is stored. However, this doesn't seem to be the case:

> const cacache = require('cacache');
undefined
> const cache = "test-cache"
undefined
> cacache.put(cache, 'key', 'example data').then(console.log);
Integrity {
  sha512: [
    Hash {
      source: 'sha512-7VnFdZqezlFs7AwGIxQtDp/nCifXUO7n/Tj0VQ1Qrd2HPQ+hpR/II8Hj1craID9KBdgyXKrLfT4HJ6cB8/B+Xw==',
      algorithm: 'sha512',
      digest: '7VnFdZqezlFs7AwGIxQtDp/nCifXUO7n/Tj0VQ1Qrd2HPQ+hpR/II8Hj1craID9KBdgyXKrLfT4HJ6cB8/B+Xw==',
      options: []
    }
  ]
}
> cacache.get.info(cache, 'key').then(console.log);
{
  key: 'key',
  integrity: 'sha512-7VnFdZqezlFs7AwGIxQtDp/nCifXUO7n/Tj0VQ1Qrd2HPQ+hpR/II8Hj1craID9KBdgyXKrLfT4HJ6cB8/B+Xw==',
  path: 'test-cache/content-v2/sha512/ed/59/c5759a9ece516cec0c0623142d0e9fe70a27d750eee7fd38f4550d50addd873d0fa1a51fc823c1e3d5cada203f4a05d8325caacb7d3e0727a701f3f07e5f',
  size: 12,
  time: 1560700127248,
  metadata: undefined
}

Note that the path property includes the test-cache/ prefix, whereas based on the docs I would have expected it to not include that prefix. I opened an issue because I'm not sure if this is a bug or a documentation error (or if I'm just misinterpreting).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions