Hi everyone,
I’m brand new to Meteor (since a week to be honest)
I’m trying to create a txt file that could be downloaded from a link.
I used the following code on the lib/router.js :
Router.route('/tex',{
action: function(){
var text = "this is a text supercool";
var filename = 'test_ex'+'.txt';
var headers = {
'Content-Type': 'plain/text',
'Content-Disposition': "attachment; filename=" + filename
};
this.response.writeHead(200, headers);
return this.response.end(text);
}
});
And then on the client html page I simply used:
<a href="/tex">Download</a>
The problem here is that nothing is happening when I press the link on the page.
And I was expecting the txt file to be downloaded.
Have I done something wrong, could someone help me on this point ?
Thanks guys !