I am trying to do the following to parse an html document:
function process_url_handler(res) {
// ...
const node = xpath.fromPageSource(res);
}
for (const url of urls) {
console.log(`${'-'.repeat(10)} ${url} ${'-'.repeat(10)}`);
let request = https.get(url, (res) => process_url_handler(res));
Res
is of type IncomingMessage
. How would I get that as raw text so I can grab the html node?