cacache icon indicating copy to clipboard operation
cacache copied to clipboard

[BUG] calling verify() should not modify the time property

Open k2s opened this issue 3 years ago • 0 comments

What / Why

Documentation says about property time: Timestamp the entry was first added on. Running cacache.verify() internally uses insert() method and sets time property to Date.now(). This is not what user expects and it makes the time property unusable.

How

const cachePath = '/tmp/cacache'
const key = 'key'

await cacache.put(cachePath, key, 'hello')
const item1 = await cacache.get.info(cachePath, key)
await cacache.verify(cachePath)
const item2 = await cacache.get.info(cachePath, key)

console.log(item1.time, item2.time, item1.time === item2.time ? 'ok' : 'WRONG')

k2s avatar May 07 '21 19:05 k2s