humanReadableBytes = function (fileSizeInBytes) {
  fileSizeInBytes = parseInt(fileSizeInBytes);

  if (isNaN(fileSizeInBytes)) { return '0'; }

  let i = 0;
  const byteUnits = ['Bi', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi', 'Yi'];
  while (fileSizeInBytes >= 1000) {
    fileSizeInBytes = fileSizeInBytes / 1024;
    i++;
  }

  if (i === 0 || fileSizeInBytes >= 10) {
    return fileSizeInBytes.toFixed(0) + byteUnits[i];
  } else {
    return fileSizeInBytes.toFixed(1) + byteUnits[i];
  }
}
Modifies a number to display the <=4 char human readable version of bytes
Modified http://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable

@example
'{{ 1524680821 | humanReadableBytes }}'
this.$options.filters.humanReadableBytes(1524680821);

@param {int} fileSizeInBytes The number to make human readable
@returns {string}            The <=4 char human readable number