katoikia-app/web-ui/web-react/node_modules/cacache/lib/content/rm.js

23 lines
468 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
'use strict'
const util = require('util')
const contentPath = require('./path')
const { hasContent } = require('./read')
const rimraf = util.promisify(require('rimraf'))
module.exports = rm
function rm (cache, integrity) {
return hasContent(cache, integrity).then((content) => {
if (content) {
const sri = content.sri
if (sri) {
return rimraf(contentPath(cache, sri)).then(() => true)
}
} else {
return false
}
})
}