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

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

Activity

  1. zkat commented on Jun 16, 2019

    @zkat
    Owner

    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?

  2. hdgarrood commented on Jun 16, 2019

    @hdgarrood
    ContributorAuthor

    Yep, can do!

  3. added a commit that references this issue on Jun 16, 2019
    02d3650
  4. added a commit that references this issue on Jun 16, 2019
    90f40f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions