Convertendo o tamanho do arquivo em bytes em sequência legível por humanos

Estou usando esta função para converter um tamanho de arquivo em bytes para um tamanho de arquivo legível por humanos: function getReadableFileSizeString(fileSizeInBytes) { var i = -1; var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; do { fileSizeInBytes = fileSizeInBytes...