Thursday, 13 April 2023

Download blob never each 100%

I have a web based file repository where the files are stored as Base64 in IndexebDB. The page is offline based and used on vessels with poor or no internet connection.

For some reason, the download never ends, causing the file extension to stay as .crdownload and file cannot be opened. This does not happen on my PC with good internet, but I'm not sure why that should matter

var link = document.createElement('a');
var isBlob = input instanceof Blob;
var uri = isBlob ? window.URL.createObjectURL(input) : input;
    
link.href = uri;
link.download = filename;

document.body.appendChild(link);

link.click();


setTimeout(() => {
    window.URL.revokeObjectURL(uri);
    document.body.removeChild(a);
}, 100);

Never ending download



from Download blob never each 100%

No comments:

Post a Comment