Problem: When I tried the following code in Meteor.js, the file is downloaded by Chrome as download (1)
without any file extension.
Is e.target.download = "data.csv"
supposed to both trigger the download of the file and rename it to "data.csv"? The naming of the file does not seem to work when using e.target.download
client/views/results.js
Template.results.events({
'click #downloadCsv': function (e) {
var csv = json2csv(data, false, true)
e.target.href = "data:text/csv;charset=utf-8," + escape(csv)
e.target.download = "data.csv";
}
})
Code snippet taken from https://github.com/axwaxw/json2csv/