(bytes: number)
| 77 | |
| 78 | // Format file size to human readable |
| 79 | const formatFileSize = (bytes: number): string => { |
| 80 | if (bytes === 0) return ''; |
| 81 | const k = 1024; |
| 82 | const sizes = ['B', 'KB', 'MB', 'GB']; |
| 83 | const i = Math.floor(Math.log(bytes) / Math.log(k)); |
| 84 | return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`; |
| 85 | }; |
| 86 | |
| 87 | /** |
| 88 | * FilePicker component - File browser with fuzzy search |