const directDownload = (blob, fileName) => {
const ghostLink = document.createElement('a');
document.body.appendChild(ghostLink);
ghostLink.style = 'display: none';
const urlFile = window.URL.createObjectURL(blob);
ghostLink.href = urlFile;
ghostLink.download = fileName;
ghostLink.click();
window.URL.revokeObjectURL(urlFile);
};
export const downloadFile = (file) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', `${file.archiveOceanUrlDescription}`);
xhr.responseType = 'blob';
xhr.onload = () => directDownload(xhr.response, file.archiveOriginalName);
xhr.send();
};