Jason Peng Jason Peng - 1 month ago 6
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
or
Event: end
in
Class: http.IncomingMessage
in https://nodejs.org/dist/latest-v6.x/docs/api/http.html

Please tell me why.

Answer

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'.

Comments