Guest User

Guest User

  • Tech Writer
  • 111
  • 14.6k

i have physical path how to download that file from js

Aug 2 2019 1:35 PM
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}

Answers (2)