3 examples of 'js download' in JavaScript

Every line of 'js download' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
7export function download(url) {
8 const iframe = document.createElement("iframe");
9 iframe.src = url;
10 iframe.style.display = "none";
11 document.body.appendChild(iframe);
12}
505function download(filename, url) {
506 var a = window.document.createElement('a'),
507 bd = document.querySelector('body');
508 bd.appendChild(a);
509 a.setAttribute('href', url);
510 a.setAttribute('download', filename);
511 a.click();
512 bd.removeChild(a);
513}
16function download(url: string, filename: string) {
17 console.log(`download ${url}...`)
18 return new Promise((resolve) => {
19 request(url, resolve).pipe(fs.createWriteStream(filename))
20 });
21}

Related snippets