mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 11:39:26 +01:00
6 lines
286 B
TypeScript
6 lines
286 B
TypeScript
export function formatSpeed(bytesPerSecond: number): string {
|
|
if (bytesPerSecond < 1024) return `${bytesPerSecond.toFixed(0)} B/s`
|
|
if (bytesPerSecond < 1024 * 1024) return `${(bytesPerSecond / 1024).toFixed(1)} KB/s`
|
|
return `${(bytesPerSecond / (1024 * 1024)).toFixed(1)} MB/s`
|
|
}
|