diff options
author | koichik <koichik@improvement.jp> | 2011-06-11 17:09:40 +0400 |
---|---|---|
committer | koichik <koichik@improvement.jp> | 2011-07-09 08:23:28 +0400 |
commit | 87b6dc21c8caf57303d1ae5049805116118b998c (patch) | |
tree | 08014875a083894176fa00e0518567386462a061 /doc | |
parent | fc80ee947a65e32c93439ede4afbd469fa58f20c (diff) |
Doc improvements
moved 'continue' event from http.Agent to http.ClientRequest.
added 'close' event to http.ClientResponse.
added 'open' event to fs.ReadStream.
Fixes #1169.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/fs.markdown | 6 | ||||
-rw-r--r-- | doc/api/http.markdown | 37 |
2 files changed, 29 insertions, 14 deletions
diff --git a/doc/api/fs.markdown b/doc/api/fs.markdown index 8592594afa5..4c37a1682ae 100644 --- a/doc/api/fs.markdown +++ b/doc/api/fs.markdown @@ -398,6 +398,12 @@ Objects returned from `fs.stat()` and `fs.lstat()` are of this type. `ReadStream` is a `Readable Stream`. +### Event: 'open' + +`function (fd) { }` + + `fd` is the file descriptor used by the ReadStream. + ### fs.createReadStream(path, [options]) Returns a new ReadStream object (See `Readable Stream`). diff --git a/doc/api/http.markdown b/doc/api/http.markdown index 4dadec75541..153b8e80244 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -52,7 +52,7 @@ per connection (in the case of keep-alive connections). ### Event: 'checkContinue' -`function (request, response) {}` +`function (request, response) { }` Emitted each time a request with an http Expect: 100-continue is received. If this event isn't listened for, the server will automatically respond @@ -68,7 +68,7 @@ not be emitted. ### Event: 'upgrade' -`function (request, socket, head)` +`function (request, socket, head) { }` Emitted each time a client requests a http upgrade. If this event isn't listened for, then clients requesting an upgrade will have their connections @@ -84,7 +84,7 @@ sent to the server on that socket. ### Event: 'clientError' -`function (exception) {}` +`function (exception) { }` If a client connection emits an 'error' event - it will forwarded here. @@ -476,7 +476,7 @@ agent. The `http.getAgent()` function allows you to access the agents. ### Event: 'upgrade' -`function (response, socket, head)` +`function (response, socket, head) { }` Emitted each time a server responds to a request with an upgrade. If this event isn't being listened for, clients receiving an upgrade header will have @@ -530,14 +530,6 @@ A client server pair that show you how to listen for the `upgrade` event using ` }); -### Event: 'continue' - -`function ()` - -Emitted when the server sends a '100 Continue' HTTP response, usually because -the request contained 'Expect: 100-continue'. This is an instruction that -the client should send the request body. - ### agent.maxSockets By default set to 5. Determines how many concurrent sockets the agent can have open. @@ -593,6 +585,14 @@ This is a `Writable Stream`. This is an `EventEmitter` with the following events: +### Event: 'continue' + +`function () { }` + +Emitted when the server sends a '100 Continue' HTTP response, usually because +the request contained 'Expect: 100-continue'. This is an instruction that +the client should send the request body. + ### Event 'response' `function (response) { }` @@ -639,18 +639,27 @@ The response implements the `Readable Stream` interface. ### Event: 'data' -`function (chunk) {}` +`function (chunk) { }` Emitted when a piece of the message body is received. ### Event: 'end' -`function () {}` +`function () { }` Emitted exactly once for each message. No arguments. After emitted no other events will be emitted on the response. +### Event: 'close' + +`function (err) { }` + +Indicates that the underlaying connection was terminated before +`end` event was emitted. +See [http.ServerRequest](#http.ServerRequest)'s `'close'` event for more +information. + ### response.statusCode The 3-digit HTTP response status code. E.G. `404`. |