| 184 | } |
| 185 | |
| 186 | async verify () { |
| 187 | // this is a derived value |
| 188 | const cachePath = this.npm.flatOptions.cache |
| 189 | const prefix = cachePath.indexOf(process.env.HOME) === 0 |
| 190 | ? `~${cachePath.slice(process.env.HOME.length)}` |
| 191 | : cachePath |
| 192 | const stats = await cacache.verify(cachePath) |
| 193 | output.standard(`Cache verified and compressed (${prefix})`) |
| 194 | output.standard(`Content verified: ${stats.verifiedContent} (${stats.keptSize} bytes)`) |
| 195 | if (stats.badContentCount) { |
| 196 | output.standard(`Corrupted content removed: ${stats.badContentCount}`) |
| 197 | } |
| 198 | if (stats.reclaimedCount) { |
| 199 | output.standard(`Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`) |
| 200 | } |
| 201 | if (stats.missingContent) { |
| 202 | output.standard(`Missing content: ${stats.missingContent}`) |
| 203 | } |
| 204 | output.standard(`Index entries: ${stats.totalEntries}`) |
| 205 | output.standard(`Finished in ${stats.runTime.total / 1000}s`) |
| 206 | } |
| 207 | |
| 208 | // npm cache ls [<spec> ...] |
| 209 | async ls (specs) { |