I'm trying to write a buffer which returns from server to the client response.
Therefore, I've defined a route which runs to fetch file on action
function:
Router.route('/download/:blabla', {
name: 'download',
action: function () {
var that = this.response;
Meteor.call('downloadFile', blabla, function (err, result) {
// error check etc.
var headers = {
'Content-type' : 'application/octet-stream',
'Content-Disposition' : 'attachment; filename=' + fileName
};
that.writeHead(200, headers);
that.end(result);
}
}
});
This throws:
Exception in delivering result of invoking 'downloadFile': TypeError: that.writeHead is not a function
Without Metoer.call it works...
I'm using nodejs stream to fetch buffer on server side function and it works.
Thanks in advance