Skip to content

Instantly share code, notes, and snippets.

@devansvd
Created February 12, 2018 06:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devansvd/84b2aa622ef9b9d7f0fe1cf2a55c239b to your computer and use it in GitHub Desktop.
Save devansvd/84b2aa622ef9b9d7f0fe1cf2a55c239b to your computer and use it in GitHub Desktop.
//callback test
function getInfo(options, callback){
http.get(options, function(res) {
console.error("Got response: " + res.statusCode);
res.on("data", function(chunk) {
console.error("BODY: " + chunk);
text = '' + chunk;
return callback(text);
});
}).on('error', function(e) {
text = 'error' + e.message;
console.error("Got error: " + e.message);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment