plugins/user_quota/girder_user_quota/web_client/utilities/Conversions.js
function sizeToValueAndUnits(sizeValue) {
    var sizeUnits = 0;
    if (sizeValue) {
        for (sizeUnits = 0; sizeUnits < 4 && parseInt(sizeValue / 1024, 10) *
                1024 === sizeValue; sizeUnits += 1) {
            sizeValue /= 1024;
        }
    } else {
        sizeValue = '';
    }
    return {sizeUnits: sizeUnits, sizeValue: sizeValue};
}
function sizeToValueAndUnits(sizeValue) {
    var sizeUnits = 0;
    if (sizeValue) {
        for (sizeUnits = 0; sizeUnits < 4 && parseInt(sizeValue / 1024, 10) *
                1024 === sizeValue; sizeUnits += 1) {
            sizeValue /= 1024;
        }
    } else {
        sizeValue = '';
    }
    return {sizeUnits: sizeUnits, sizeValue: sizeValue};
}
/* Convert a number of bytes to a value and units.  The units are the
powers of 1024.  For instance, 4096 will result in (4, 1).
@param sizeValue: number of bytes to convert.  If this is falsy, an
empty string is returned.
@return .sizeValue: the new size value.  This may be an empty string.
@return .sizeUnits: the size units (0-based powers of 1024).