Answers for "byte to gb javascript"

1

byte to gb javascript

function bytes_to_size(bytes) {
        var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
        if (bytes == 0) return '0 Byte';
        var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
        return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
    },
Posted by: Guest on February-16-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language