Skip to content

Commit 87b6dc2

Browse files
committed
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.
1 parent fc80ee9 commit 87b6dc2

2 files changed

Lines changed: 29 additions & 14 deletions

File tree

doc/api/fs.markdown

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,12 @@ Objects returned from `fs.stat()` and `fs.lstat()` are of this type.
398398

399399
`ReadStream` is a `Readable Stream`.
400400

401+
### Event: 'open'
402+
403+
`function (fd) { }`
404+
405+
`fd` is the file descriptor used by the ReadStream.
406+
401407
### fs.createReadStream(path, [options])
402408

403409
Returns a new ReadStream object (See `Readable Stream`).

doc/api/http.markdown

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ per connection (in the case of keep-alive connections).
5252

5353
### Event: 'checkContinue'
5454

55-
`function (request, response) {}`
55+
`function (request, response) { }`
5656

5757
Emitted each time a request with an http Expect: 100-continue is received.
5858
If this event isn't listened for, the server will automatically respond
@@ -68,7 +68,7 @@ not be emitted.
6868

6969
### Event: 'upgrade'
7070

71-
`function (request, socket, head)`
71+
`function (request, socket, head) { }`
7272

7373
Emitted each time a client requests a http upgrade. If this event isn't
7474
listened for, then clients requesting an upgrade will have their connections
@@ -84,7 +84,7 @@ sent to the server on that socket.
8484

8585
### Event: 'clientError'
8686

87-
`function (exception) {}`
87+
`function (exception) { }`
8888

8989
If a client connection emits an 'error' event - it will forwarded here.
9090

@@ -476,7 +476,7 @@ agent. The `http.getAgent()` function allows you to access the agents.
476476

477477
### Event: 'upgrade'
478478

479-
`function (response, socket, head)`
479+
`function (response, socket, head) { }`
480480

481481
Emitted each time a server responds to a request with an upgrade. If this
482482
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 `
530530
});
531531

532532

533-
### Event: 'continue'
534-
535-
`function ()`
536-
537-
Emitted when the server sends a '100 Continue' HTTP response, usually because
538-
the request contained 'Expect: 100-continue'. This is an instruction that
539-
the client should send the request body.
540-
541533
### agent.maxSockets
542534

543535
By default set to 5. Determines how many concurrent sockets the agent can have open.
@@ -593,6 +585,14 @@ This is a `Writable Stream`.
593585

594586
This is an `EventEmitter` with the following events:
595587

588+
### Event: 'continue'
589+
590+
`function () { }`
591+
592+
Emitted when the server sends a '100 Continue' HTTP response, usually because
593+
the request contained 'Expect: 100-continue'. This is an instruction that
594+
the client should send the request body.
595+
596596
### Event 'response'
597597

598598
`function (response) { }`
@@ -639,18 +639,27 @@ The response implements the `Readable Stream` interface.
639639

640640
### Event: 'data'
641641

642-
`function (chunk) {}`
642+
`function (chunk) { }`
643643

644644
Emitted when a piece of the message body is received.
645645

646646

647647
### Event: 'end'
648648

649-
`function () {}`
649+
`function () { }`
650650

651651
Emitted exactly once for each message. No arguments. After
652652
emitted no other events will be emitted on the response.
653653

654+
### Event: 'close'
655+
656+
`function (err) { }`
657+
658+
Indicates that the underlaying connection was terminated before
659+
`end` event was emitted.
660+
See [http.ServerRequest](#http.ServerRequest)'s `'close'` event for more
661+
information.
662+
654663
### response.statusCode
655664

656665
The 3-digit HTTP response status code. E.G. `404`.

0 commit comments

Comments
 (0)