File size: 281 Bytes
a03b3ba |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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;
};
|