Function
deleteInCacheSha
(sha, returnFileSize = false)
Source from the content-addressed store, hash-verified
| 600 | |
| 601 | |
| 602 | function deleteInCacheSha(sha, returnFileSize = false) |
| 603 | { |
| 604 | let cachePath = p.join(cacheFolder, sha+'.jpg'); |
| 605 | |
| 606 | if(data[sha]) |
| 607 | delete data[sha]; |
| 608 | |
| 609 | let fileSize = 0; |
| 610 | |
| 611 | if(fs.existsSync(cachePath)) |
| 612 | { |
| 613 | if(returnFileSize) |
| 614 | fileSize = fs.statSync(cachePath).size; |
| 615 | |
| 616 | fs.unlinkSync(cachePath); |
| 617 | } |
| 618 | |
| 619 | return fileSize; |
| 620 | } |
| 621 | |
| 622 | function purge() |
| 623 | { |
Tested by
no test coverage detected