finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
499 bytes
|
| Rev | Line | |
|---|
| [81bc7da] | 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.