490 B
490 B
blob file download
const download=()=>{
fetch(`${HOST}`,{
})
.then(res=>res.blob())
.then(blob=>{
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.download = "extraordinary12.mp3";
link.href = url;
link.click();
})
.catch(console.log)
}
creating a text blob
const textData = "Hello, this is my text content!";
const textBlob = new Blob([textData], { type: 'text/plain' });