I need to run two nested async functions and return callback from the second one to the client. future.return doesn't work inside Fibers. How to return result to the client without using collections?
Meteor.methods({
'youtube':function(object) {
var youTube = new YouTube();
youTube.search(object.song, 1, function(error, result) {
if (error) {
console.log(error);
}
else {
Fiber(function() {
var future = new Future();
ytdl.getInfo(result.url, function(err, result) {
future.return({data: result});
});
return future.wait();
}).run();
}
});
});