Hello:)
You can easily download a custom text using js.
function Download(){
var name = "file name"
const content = "text";
const element = document.createElement('a');
const blob= new Blob([content], {
type:'plain/text'
});
const fileurl = URL.createObjectURL(blob);
element.setAttribute('href', fileurl);
element.setAttribute('download', name+".html");
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
This function will download a file as a text file
Top comments (0)