Javascript String File Size from Bytes Integer

function formatBytes(bytes) {
    if (0 === bytes)
        return '0 Bytes';
    const sizes = [
            'Bytes',
            'KB',
            'MB',
            'GB',
            'TB',
            'PB',
            'EB',
            'ZB',
            'YB'
        ],
        s = Math.floor(Math.log(bytes) / Math.log(1024)),
        size = bytes / Math.pow(1024, s);
    return `${size.toFixed(2)} ${sizes[s]}`
}