So I'm calling a method from the client that has a callback:
Meteor.call("readHeaders", Meteor.user().emails[0].address+'/'+Session.get("file1"),
function(err,result){
console.log(result);
});
and here is the method that's being called:
readHeaders: function(fileName){
var nodeFS = Meteor.npmRequire('node-fs');
nodeFS.readFile("somepath/"+fileName,'utf8', function read(err, data){
if (err) {
throw err;
}
var headers = [data.slice(0,data.indexOf('\n')).split(",")];
return headers;
});
}
The correct result gets printed on the server, but on the client it returns undefined. Any suggestions?