(text: string)
| 115 | } catch (e) { |
| 116 | console.error("Failed to save nezha config:", e); |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | function formatBytes(bytes: number): string { |
| 121 | if (bytes === 0) return "0 B"; |
| 122 | const k = 1024; |
| 123 | const sizes = ["B", "KB", "MB", "GB", "TB"]; |
| 124 | const i = Math.floor(Math.log(bytes) / Math.log(k)); |
| 125 | return (bytes / Math.pow(k, i)).toFixed(2) + " " + sizes[i]; |
| 126 | } |
| 127 | |
| 128 | function formatSpeed(bytes: number): string { |
no outgoing calls
no test coverage detected