J Hill

Generation

generate functionThu, 01 Dec 2022

Create code to download .pdf files to be stored on the cloud

// Download a pdf file db.getAttachment("tutorial", "tutorial.pdf").then(function(blob) { var url = URL.createObjectURL(blob); var a = document.createElement("a"); a.style = "display: none"; a.href = url; a.download = "tutorial.pdf"; document.body.appendChild(a); a.click(); setTimeout(function() { document.body.removeChild(a); window.URL.revokeObjectURL(url); }, 100); }).catch(function(error) { console.log(error); });

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant