mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-27 02:30:17 +08:00
f94db6b731
* File table style with accessible file name texts * Fix for lint * add changeset * Remove unnecessary style --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
13 lines
281 B
TypeScript
13 lines
281 B
TypeScript
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;
|
|
};
|