function humanFileSize(bytes, units) {
    if (Math.abs(bytes) < 1024) {
        return '' + bytes + units[0];
    }
    var u = 0;
    do {
        bytes /= 1024;
        ++u;
    } while (Math.abs(bytes) >= 1024 && u < units.length);
    return '' + bytes.toFixed(1) + units[u];
}
Convert a number of bytes to a human-readable file size. If you desire
to add a space between the value and the unit, you need to add this space
to the given units.
@param bytes {number} A number of bytes, as integer. Ex: 421137
@param units {number[]} An array of human-readable units, ie. [' B', ' K', ' MB']
@returns string A human-readable file size. Ex: '412 KB'