: Open Notepad , type your text, and go to File > Save As .
const content = "Your text here"; const blob = new Blob([content], { type: 'text/plain' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'filename.txt'; a.click(); URL.revokeObjectURL(url); Use code with caution. Copied to clipboard
content = "Hello, world!" with open("newfile.txt", "w") as f: f.write(content) Use code with caution. Copied to clipboard
: Use headers to force the browser to download a text file generated by your script.