Browse Source

doc: add the note about 'data' event

Refs #2691.
v0.7.4-release
koichik 13 years ago
parent
commit
a2cd31cbf1
  1. 22
      doc/api/http.markdown
  2. 3
      doc/api/net.markdown
  3. 3
      doc/api/streams.markdown

22
doc/api/http.markdown

@ -128,7 +128,8 @@ See [net.Server.close()](net.html#server.close).
This object is created internally by a HTTP server -- not by
the user -- and passed as the first argument to a `'request'` listener.
This is an `EventEmitter` with the following events:
The request implements the [Readable Stream](streams.html#readable_Stream)
interface. This is an `EventEmitter` with the following events:
### Event: 'data'
@ -141,6 +142,9 @@ argument. The transfer-encoding has been decoded. The
body chunk is a string. The body encoding is set with
`request.setEncoding()`.
Note that the __data will be lost__ if there is no listener when a
`ServerRequest` emits a `'data'` event.
### Event: 'end'
`function () { }`
@ -245,7 +249,10 @@ authentication details.
## http.ServerResponse
This object is created internally by a HTTP server--not by the user. It is
passed as the second parameter to the `'request'` event. It is a `Writable Stream`.
passed as the second parameter to the `'request'` event.
The response implements the [Writable Stream](streams.html#writable_Stream)
interface. This is an `EventEmitter` with the following events:
### Event: 'close'
@ -575,11 +582,11 @@ event, the entire body will be caught.
}, 10);
});
This is a `Writable Stream`.
Note: Node does not check whether Content-Length and the length of the body
which has been transmitted are equal or not.
This is an `EventEmitter` with the following events:
The request implements the [Writable Stream](streams.html#writable_Stream)
interface. This is an `EventEmitter` with the following events:
### Event 'response'
@ -711,7 +718,9 @@ will be called.
This object is created when making a request with `http.request()`. It is
passed to the `'response'` event of the request object.
The response implements the `Readable Stream` interface.
The response implements the [Readable Stream](streams.html#readable_Stream)
interface. This is an `EventEmitter` with the following events:
### Event: 'data'
@ -719,6 +728,9 @@ The response implements the `Readable Stream` interface.
Emitted when a piece of the message body is received.
Note that the __data will be lost__ if there is no listener when a
`ClientResponse` emits a `'data'` event.
### Event: 'end'

3
doc/api/net.markdown

@ -395,6 +395,9 @@ Emitted when data is received. The argument `data` will be a `Buffer` or
(See the [Readable Stream](streams.html#readable_Stream) section for more
information.)
Note that the __data will be lost__ if there is no listener when a `Socket`
emits a `'data'` event.
#### Event: 'end'
`function () { }`

3
doc/api/streams.markdown

@ -15,6 +15,9 @@ A `Readable Stream` has the following methods, members, and events.
The `'data'` event emits either a `Buffer` (by default) or a string if
`setEncoding()` was used.
Note that the __data will be lost__ if there is no listener when a
`Readable Stream` emits a `'data'` event.
### Event: 'end'
`function () { }`

Loading…
Cancel
Save