(bytes: number)
| 19 | }); |
| 20 | |
| 21 | const formatBytes = (bytes: number): string => { |
| 22 | if (bytes < 1024) return `${bytes} B`; |
| 23 | |
| 24 | return `${(bytes / 1024).toFixed(2)} kB`; |
| 25 | }; |
| 26 | |
| 27 | const toSourceString = (source: string | Uint8Array): string => |
| 28 | typeof source === "string" ? source : Buffer.from(source).toString("utf8"); |