Jason Peng Jason Peng - 1 year ago 98
Node.js Question

Node.js: Cannot find 'data', 'end' event in http.IncomingMessage in docs

We always write:

http.createServer(function(req, res) {
req.on('data', function(){})
.on('end', function(){});

But the problems is: I can't find any breath of
Event: data
Event: end
Class: http.IncomingMessage
in https://nodejs.org/dist/latest-v6.x/docs/api/http.html

Please tell me why.

Answer Source

At the documentation for HTTP.IncomingMessage, it says:

It implements the Readable Stream interface, as well as the following additional events, methods, and properties.

If you check the Stream.Readable documentation, you can find Event: 'data' and Event: 'end'.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download