Hi, I am confuse on this,how to make this work…I’m just reading some example but it did not show how to have data in console.log(); or to display the chunk.
Should work I think. I’m fairly new to Node.js myself.
Why aren’t you using a framework like Express? You’ll have better luck doing Express tutorials rather than trying to do it all manually directly in Node.
Thank you for the reply,…I know that will work the code that i posted, I just want to ask when will it receive the data or the chunk ?..I am opening in the browser 127.0.0.1:1337 but nothing happens.
chunk Buffer | String The chunk of data.
If you attach a data event listener, then it will switch the stream into flowing mode, and data will be passed to your handler as soon as it is available.
If you just want to get all the data out of the stream as fast as possible, this is the best way to do so.
The chunk is the string buffer. It is partial data.