I'm kind of lost. Is it possible to get the response body as a string in .on(response) (see below)? Or am I crazy? I know I can .pipe the response to a WriteStream, but I need both the response body and the response statusCode at the same place in order to continue my code. Thanks!
var request = require("request");
request(url)
.on('response', function(response) {
console.log(response.statusCode); // 200
console.log(/* I need to get response body string here */); // <--- can I have the response body as a string here?
})
.on("error", function(err){
console.log("Problem reaching URL: ", err);
});