Skip to content
This repository has been 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 opened this issue Jun 16, 2019 · 2 comments · Fixed by #166
Closed

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

hdgarrood opened this issue Jun 16, 2019 · 2 comments · Fixed by #166

Comments

@hdgarrood
Copy link
Contributor

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).

@zkat
Copy link
Owner

zkat commented Jun 16, 2019

It's probably best to update the documentation here to be more clear. This is definitely a wording issue -- changing the path field to be what the docs seem to say would be a pretty impactful breaking change.

Would you be up to filing a PR to fix the docs?

@hdgarrood
Copy link
Contributor Author

Yep, can do!

hdgarrood added a commit to hdgarrood/cacache that referenced this issue Jun 16, 2019
Fixes zkat#165. I don't speak Spanish but I made an attempt at updating
README.es.md too, based on the "joined with `cachePath`" comments I saw
in the `ls` docs; hopefully what I've got here makes sense :)
@zkat zkat closed this as completed in #166 Jun 16, 2019
zkat pushed a commit that referenced this issue Jun 16, 2019
* Fix docs for `path` property in get.info

Fixes #165. I don't speak Spanish but I made an attempt at updating
README.es.md too, based on the "joined with `cachePath`" comments I saw
in the `ls` docs; hopefully what I've got here makes sense :)

* Update README.es.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants