summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/cacache/lib/content/rm.js
blob: a8903dc0e35ce3bacf02f129f74c3d05bc3e02f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict'

const BB = require('bluebird')

const contentPath = require('./path')
const hasContent = require('./read').hasContent
const rimraf = BB.promisify(require('rimraf'))

module.exports = rm
function rm (cache, integrity) {
  return hasContent(cache, integrity).then(content => {
    const sri = content.sri
    if (sri) {
      return rimraf(contentPath(cache, sri))
    }
  })
}