Is new Blob() cutting off BOM mark?

38 views Asked by At

I have some API. That API returns file content with BOM mark. I want to put the received data into a new file and then let user to download it. That file has to contain BOM mark provided from API. I am doing it that way:

function downloadFile(data, name, type) {
    const a = document.createElement('a');
    const file = new Blob([data], { type });
    a.href = URL.createObjectURL(file);
    a.download = name;
    a.click();
}

Unfortunately, result file does not have BOM mark.

I've checked via Postman that API response data has BOM mark.

0

There are 0 answers