mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-28 16:40:00 -07:00
Add ability to get qmdl file size in user readable values
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user