I have a variable in javascript which i want to convert in txt file and then download. Please suggest.
var data = '<?xml version="1.0" encoding="utf-8"?><info><scope><vendor id="37515"><id="175090453884"/></vendor></scope><vc>YoAAQA=</vc></info>';
i have implemented below code as well but not working.
if(!contentType) contentType = 'application/octet-stream';
var a = document.createElement('a');
var blob = new Blob([data ], {'type':""text/csv""});
a.href = window.URL.createObjectURL(blob);
a.download = "aa.txt";
a.click();