export function get_size(kbytes: number): string { if (kbytes < 1024) { return `${kbytes} KiB`; } const units = ["MiB", "GiB", "TiB"]; let size = kbytes / 1024; let unitIndex = 0; while (size >= 1024 && unitIndex < units.length - 1) { size /= 1024; unitIndex++; } return `${Math.round(size)} ${units[unitIndex]}`; }