Function
function getpage(link, callback){
var options = {
method: 'GET',
uri: link,
headers: {
'Authorization': 'Basic ' + new Buffer("c64f80ba83d7cfce8ae74f51e263ce93:").toString('base64')
}
};
request(options, function (err, response, body) {
callback(body);
});
}
Code working when:
getpage('https://docs.google.com/feeds/get_video_info?formats=ios&mobile=true&docid=0BxG6kVC7OXgrQ1V6bDVsVmJMZFU', console.log);
But not working when
var text = getpage(link, console.log);
console.log(text);
How do I fix it? I want data to return the same. I want to use the data in other function.
Thanks