function formatFileSize(bytes, unit, fraction){
  if(_.isNumber(bytes)) {
    var factors = {
      'si': [1000, 'k', 'B'], // International System of Units (SI) (base 10)
      'iec': [1024, 'K', 'iB'], // International Electrotechnical Commission (IEC) (base 2)
      'ip': [1024, 'K', 'B'] // Industry Practice (base 2)
    };

    var factor = factors[_.toLower(unit)] || factors.ip;
    /*jshint -W016 */
    var a = Math.log(bytes) / Math.log(factor[0]) | 0;
    /*jshint +W016 */
    var value = (bytes / Math.pow(factor[0], a));

    return _.formatStringEx('{value} {unit}', {
      value: (a ? value.toFixed(_.isUndefined(fraction) ? 2 : fraction) : value),
      unit: (a ? (factor[1] + 'MGTPEZY')[--a] + factor[2] : 'Bytes')
    });
  }

  return undefined;
}
Formats a file size to a more readable string.
For better understanding read the sections "Main memory" and "Disk drives" at "https://en.wikipedia.org/wiki/Binary_prefix"

@static
@memberOf _
@param {number} bytes - The size of the file in bytes.
@param {string} [unit='iec'] - The format of the output.
@param {number} [fraction=2] - The fraction of floating numbers
@returns {string | undefined} The formatted file size.
@example
_.formatFileSize(1000000, 'iec'); => '976.56 KiB'
_.formatFileSize(1000000, 'si'); => '1 MB'
_.formatFileSize(1000000, 'ip'); => '976.56 KB'