Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

download text file javascript

const downloadTxtFile = () => {
    const element = document.createElement("a");
    const file = new Blob([text], {
      type: "text/plain",
    });
    element.href = URL.createObjectURL(file);
    element.download = "myFile.txt";
    document.body.appendChild(element);
    element.click();
  };
Source by www.textbotonline.com #
 
PREVIOUS NEXT
Tagged: #download #text #file #javascript
ADD COMMENT
Topic
Name
5+6 =