Created
February 12, 2018 06:18
-
-
Save devansvd/84b2aa622ef9b9d7f0fe1cf2a55c239b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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