Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
doc: add the note about 'data' event
Browse files Browse the repository at this point in the history
Refs #2691.
  • Loading branch information
koichik committed Feb 5, 2012
1 parent 0f0af55 commit a2cd31c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
22 changes: 17 additions & 5 deletions doc/api/http.markdown
Expand Up @@ -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'

Expand All @@ -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 () { }`
Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -711,14 +718,19 @@ 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'

`function (chunk) { }`

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'

Expand Down
3 changes: 3 additions & 0 deletions doc/api/net.markdown
Expand Up @@ -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 () { }`
Expand Down
3 changes: 3 additions & 0 deletions doc/api/streams.markdown
Expand Up @@ -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 () { }`
Expand Down

0 comments on commit a2cd31c

Please sign in to comment.