Questions about how node http.request handles response.

  node.js, question

I am a novice, when learning to write node crawler, I encountered such problems: besides handling http.IncomingMessage in data event, what other ways?
Specific points:

const http = require('http');
 const iconv = require('iconv-lite');
 
 let fetchJueQi = http.get(options,
 (res) => {
 res.on('data', (chunk) => {
 let context = iconv.decode(chunk, 'gbk');
 Log ('content' plus context);
 })
 });

If you use this function to obtain html code for a page, there may be several console.log outputs, one section of html code at a time.
So what can I do now to directly output the entire html code at once?
Pray for a great god’s answer. I am very grateful! ! !

Create a Buffer and connect two pieces of data with Buffer.concat each time the data event triggers
Overall output after end event

The code is probably like this. I didn’t run past what I wrote. There may be some mistakes.

let content = new Buffer(0);
 res.on('data', (chunk) => {
 content = Buffer.concat([content, chunk]);
 }).on('end', () => {
 //then the content is complete
 });