'How to download svg file png file from javascript server?

I want to save the svg file provided by the server as a png file with JavaScript. I think the file format is wrong, how can I download it?

This is the code to download the svg file. I wonder how to fix it.

const accessCookie = getAccessTokenCookie();
            axios({
                url: `${baseUrl}/${this.Qrid}`,
                method: 'GET',
                // responseType: 'arraybuffer',
                headers: {
                    Authorization: `Bearer` + accessCookie,
                },
            }).then(response => {
                var file = new Blob([response.data], { type: 'image/svg' });
                const fileURL = URL.createObjectURL(file);
                const link = document.createElement('a');
                link.href = fileURL;
                link.download = 'qr' + this.$date().format('YYYY.MM.DD_h_m_s') + '.svg';
                link.click();
                console.log(response);
            });


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source