Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
499 bytes
|
Line | |
---|
1 | 'use strict'
|
---|
2 |
|
---|
3 | const util = require('util')
|
---|
4 |
|
---|
5 | const contentPath = require('./path')
|
---|
6 | const { hasContent } = require('./read')
|
---|
7 | const rimraf = util.promisify(require('rimraf'))
|
---|
8 |
|
---|
9 | module.exports = rm
|
---|
10 |
|
---|
11 | function rm (cache, integrity) {
|
---|
12 | return hasContent(cache, integrity).then((content) => {
|
---|
13 | // ~pretty~ sure we can't end up with a content lacking sri, but be safe
|
---|
14 | if (content && content.sri)
|
---|
15 | return rimraf(contentPath(cache, content.sri)).then(() => true)
|
---|
16 | else
|
---|
17 | return false
|
---|
18 | })
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.