Add ability to get qmdl file size in user readable values

This commit is contained in:
Caleb
2025-05-16 20:44:38 -04:00
committed by Cooper Quintin
parent d40d4fb9c1
commit 8e6b86b26f
4 changed files with 12 additions and 3 deletions

View File

@@ -69,6 +69,15 @@ export class ManifestEntry {
}
}
get_readable_qmdl_size(): string {
if (this.qmdl_size_bytes === 0) return "0 Bytes";
const k = 1024;
const dm = 2 || 2;
const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
const i = Math.floor(Math.log(this.qmdl_size_bytes) / Math.log(k));
return `${Number.parseFloat((this.qmdl_size_bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
}
get_num_warnings(): number | undefined {
if (this.analysis_report === undefined || typeof(this.analysis_report) === 'string') {
return undefined;