From 2f6dcee0eae6afcf1bc235004d3bb7f3f5dcf5c8 Mon Sep 17 00:00:00 2001 From: Matt Isenhower Date: Thu, 20 Aug 2026 14:29:02 -0700 Subject: [PATCH] Clarify archive compression statistics --- app/data/ArchiveStats.mjs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/data/ArchiveStats.mjs b/app/data/ArchiveStats.mjs index 7fbda56..762924f 100644 --- a/app/data/ArchiveStats.mjs +++ b/app/data/ArchiveStats.mjs @@ -54,8 +54,9 @@ export default class ArchiveStats this.console.log( `${archives.length} archives containing ${fileCount} files: ` - + `${this.formatBytes(originalBytes)} -> ${this.formatBytes(compressedBytes)}; ` - + `saved ${this.formatBytes(savedBytes)} (${this.formatPercent(savedBytes, originalBytes)}), ` + + `${this.formatBytes(originalBytes)} source data -> ${this.formatBytes(compressedBytes)} compressed; ` + + `projected source-file savings after pruning ${this.formatBytes(savedBytes)} ` + + `(${this.formatPercent(savedBytes, originalBytes)}; manifests excluded), ` + `${this.formatRatio(originalBytes, compressedBytes)}:1 compression`, ); } @@ -158,12 +159,12 @@ export default class ArchiveStats } formatBytes(bytes) { - let units = ['B', 'KB', 'MB', 'GB', 'TB']; + let units = ['B', 'KiB', 'MiB', 'GiB', 'TiB']; let unit = 0; let value = bytes; - while (Math.abs(value) >= 1000 && unit < units.length - 1) { - value /= 1000; + while (Math.abs(value) >= 1024 && unit < units.length - 1) { + value /= 1024; unit++; }