Spaces:
Running
Running
Download frontend/src/shared/format.ts from Pier-Jean/docling-studio: direct link, hf CLI and curl.
- Browser
- Download file 209 Bytes
-
https://huggingface.co/spaces/Pier-Jean/docling-studio/resolve/main/frontend/src/shared/format.ts
- Command line
-
hf download hf://spaces/Pier-Jean/docling-studio/frontend/src/shared/format.ts
-
curl -L -o format.ts https://huggingface.co/spaces/Pier-Jean/docling-studio/resolve/main/frontend/src/shared/format.ts
209 Bytes
| export function formatSize(bytes: number | null | undefined): string { | |
| if (!bytes) return '' | |
| const mb = bytes / (1024 * 1024) | |
| return mb >= 1 ? `${mb.toFixed(1)} MB` : `${(bytes / 1024).toFixed(0)} KB` | |
| } | |