(bytes: number)
| 67 | } |
| 68 | |
| 69 | function formatFileSize(bytes: number): string { |
| 70 | if (bytes === 0) return "—"; |
| 71 | const units = ["B", "KB", "MB", "GB"]; |
| 72 | const i = Math.floor(Math.log(bytes) / Math.log(1024)); |
| 73 | return `${(bytes / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0)} ${units[i]}`; |
| 74 | } |
| 75 | |
| 76 | function getMonacoLanguage(name: string): string { |
| 77 | const ext = name.split(".").pop()?.toLowerCase() || ""; |