static formatEphemeralStorageBytes()

in src/app/utils/common.util.ts [44:53]


  static formatEphemeralStorageBytes(value: number | string): string {
    const units: readonly string[] = ['kB', 'MB', 'GB', 'TB', 'PB', 'EB'];
    let unit: string = 'B';
    let toValue = +value;
    for (let i = 0, unitslen = units.length; toValue / 1000 >= 1 && i < unitslen; i = i + 1) {
      toValue = toValue / 1000;
      unit = units[i];
    }
    return `${toValue.toLocaleString(undefined, { maximumFractionDigits: 2 })} ${unit}`;
  }