feat(web): improved server stats

This commit is contained in:
Michel Heusschen
2023-02-25 15:05:58 +01:00
parent 71d8567f18
commit 09a1d56bf3
25 changed files with 199 additions and 260 deletions
+1 -2
View File
@@ -38,8 +38,7 @@ export function getBytesWithUnit(bytes: number, maxPrecision = 1): [number, stri
* @param maxPrecision maximum number of decimal places, default is `1`
* @returns localized bytes with unit as string
*/
export function asByteUnitString(bytes: number, maxPrecision = 1): string {
const locale = Array.from(navigator.languages);
export function asByteUnitString(bytes: number, locale?: string, maxPrecision = 1): string {
const [size, unit] = getBytesWithUnit(bytes, maxPrecision);
return `${size.toLocaleString(locale)} ${unit}`;
}