fetch(API_URL) .then(resp => resp.data.blob()) .then(blob => { const url = URL.createObjectURL(blob); document.getElementById("preview").src = url; });