aboutsummaryrefslogtreecommitdiff
path: root/deps/node/deps/npm/node_modules/cacache/lib/content/rm.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/node/deps/npm/node_modules/cacache/lib/content/rm.js')
-rw-r--r--deps/node/deps/npm/node_modules/cacache/lib/content/rm.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/deps/node/deps/npm/node_modules/cacache/lib/content/rm.js b/deps/node/deps/npm/node_modules/cacache/lib/content/rm.js
new file mode 100644
index 00000000..12cf1582
--- /dev/null
+++ b/deps/node/deps/npm/node_modules/cacache/lib/content/rm.js
@@ -0,0 +1,21 @@
+'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 => {
+ if (content) {
+ const sri = content.sri
+ if (sri) {
+ return rimraf(contentPath(cache, sri)).then(() => true)
+ }
+ } else {
+ return false
+ }
+ })
+}