mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 17:23:43 +00:00

PR-URL: https://github.com/nodejs/node/pull/43210 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
21 lines
493 B
JavaScript
21 lines
493 B
JavaScript
'use strict'
|
|
|
|
const util = require('util')
|
|
|
|
const contentPath = require('./path')
|
|
const { hasContent } = require('./read')
|
|
const rimraf = util.promisify(require('rimraf'))
|
|
|
|
module.exports = rm
|
|
|
|
async function rm (cache, integrity) {
|
|
const content = await hasContent(cache, integrity)
|
|
// ~pretty~ sure we can't end up with a content lacking sri, but be safe
|
|
if (content && content.sri) {
|
|
await rimraf(contentPath(cache, content.sri))
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}
|