(bytes: number)
| 20 | const jsonResponseSchema = z.unknown() |
| 21 | |
| 22 | function formatFileSize(bytes: number): string { |
| 23 | if (!Number.isFinite(bytes) || bytes <= 0) return '0 Bytes' |
| 24 | const k = 1024 |
| 25 | const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] |
| 26 | const i = Math.min(Math.floor(Math.log(bytes) / Math.log(k)), sizes.length - 1) |
| 27 | const value = bytes / k ** i |
| 28 | return `${value.toFixed(value >= 100 || i === 0 ? 0 : 1)} ${sizes[i]}` |
| 29 | } |
| 30 | |
| 31 | const multipartPartUrlSchema = z.object({ |
| 32 | partNumber: z.number(), |