JS

DOWNLOAD FILE WITH JAVASCRIPT FETCH

BLOB OBJECT DOWNLOAD

01

function dl (blob, filename) {   TO "FORCE DOWNLOAD"   var url = window.URL.     createObjectURL(blob),   a = document.createElement("a");   a.href = url;   a.download = filename;   a.click();     CLEAN UP   window.URL.revokeObjectURL(url);   document.removeChild(anchor); }

FETCH fetch("http://site.com/test.jpg") RETURN AS BLOB .then((res) => { return res.blob(); }) DOWNLOAD .then((data) => { dl(data, "test.jpg"); });

FETCH FILE DOWNLOAD

02