import type { FileData } from "@gradio/client"; | |
export const prettyBytes = (bytes: number): string => { | |
let units = ["B", "KB", "MB", "GB", "PB"]; | |
let i = 0; | |
while (bytes > 1024) { | |
bytes /= 1024; | |
i++; | |
} | |
let unit = units[i]; | |
return bytes.toFixed(1) + " " + unit; | |
}; | |