plugins/manageResource/client/js/manageResource.js
function getBytesWithUnit(bytes) {
        if (isNaN(bytes)) {
            return;
        }
        var units = [ ' bytes', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB' ];
        var amountOf2s = Math.floor(Math.log(+bytes) / Math.log(2));
        if (amountOf2s < 1) {
            amountOf2s = 0;
        }
        var i = Math.floor(amountOf2s / 10);
        bytes = +bytes / Math.pow(2, 10 * i);


        if (bytes.toString().length > bytes.toFixed(2).toString().length) {
            bytes = bytes.toFixed(2);
        }
        return bytes + units[i];
    }
function getBytesWithUnit(bytes) {
        if (isNaN(bytes)) {
            return;
        }
        var units = [ ' bytes', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB' ];
        var amountOf2s = Math.floor(Math.log(+bytes) / Math.log(2));
        if (amountOf2s < 1) {
            amountOf2s = 0;
        }
        var i = Math.floor(amountOf2s / 10);
        bytes = +bytes / Math.pow(2, 10 * i);


        if (bytes.toString().length > bytes.toFixed(2).toString().length) {
            bytes = bytes.toFixed(2);
        }
        return bytes + units[i];
    }
function getBytesWithUnit ( bytes ) { if ( isNaN ( bytes ) ) { return ; } var units = [ ' bytes' , ' KB' , ' MB' , ' GB' , ' TB' , ' PB' , ' EB' , ' ZB' , ' YB' ] ; var amountOf2s = Math . floor ( Math . log ( + bytes ) / Math . log ( 2 ) ) ; if ( amountOf2s < 1 ) { amountOf2s = 0 ; } var i = Math . floor ( amountOf2s / 10 ) ; bytes = + bytes / Math . pow ( 2 , 10 * i ) ; if ( bytes . toString ( ) . length > bytes . toFixed ( 2 ) . toString ( ) . length ) { bytes = bytes . toFixed ( 2 ) ; } return bytes + units [ i ] ; }
code with the help of google
code with the help of google