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