From e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Mon, 16 Nov 2020 00:10:28 +0100 Subject: api, login, auth --- node_modules/cacache/lib/content/rm.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 node_modules/cacache/lib/content/rm.js (limited to 'node_modules/cacache/lib/content/rm.js') diff --git a/node_modules/cacache/lib/content/rm.js b/node_modules/cacache/lib/content/rm.js new file mode 100644 index 0000000..5061236 --- /dev/null +++ b/node_modules/cacache/lib/content/rm.js @@ -0,0 +1,20 @@ +'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) => { + // ~pretty~ sure we can't end up with a content lacking sri, but be safe + if (content && content.sri) { + return rimraf(contentPath(cache, content.sri)).then(() => true) + } else { + return false + } + }) +} -- cgit v1.2.3