b534f8fe9307b46b096c51ae71a8dd6aa05c1c57bead1f5299e27858ae7346a601fe914a82099f08a664ac76d04896d07878fea2234658951f4686dcccce7c 468 B

12345678910111213141516171819202122
  1. 'use strict'
  2. const util = require('util')
  3. const contentPath = require('./path')
  4. const { hasContent } = require('./read')
  5. const rimraf = util.promisify(require('rimraf'))
  6. module.exports = rm
  7. function rm (cache, integrity) {
  8. return hasContent(cache, integrity).then((content) => {
  9. if (content) {
  10. const sri = content.sri
  11. if (sri) {
  12. return rimraf(contentPath(cache, sri)).then(() => true)
  13. }
  14. } else {
  15. return false
  16. }
  17. })
  18. }