@@ -2455,8 +2455,8 @@ added: v0.1.17
24552455* Extends: {Stream}
24562456
24572457This class serves as the parent class of [ ` http.ClientRequest ` ] [ ]
2458- and [ ` http.ServerResponse ` ] [ ] . It is an abstract of outgoing message from
2459- the perspective of the participants of HTTP transaction.
2458+ and [ ` http.ServerResponse ` ] [ ] . It is an abstract outgoing message from
2459+ the perspective of the participants of an HTTP transaction.
24602460
24612461### Event: ` 'drain' `
24622462
@@ -2480,7 +2480,7 @@ Emitted when the transmission is finished successfully.
24802480added: v0.11.6
24812481-->
24822482
2483- Emitted when ` outgoingMessage.end ` was called.
2483+ Emitted after ` outgoingMessage.end() ` is called.
24842484When the event is emitted, all data has been processed but not necessarily
24852485completely flushed.
24862486
@@ -2494,11 +2494,11 @@ added: v0.3.0
24942494
24952495Adds HTTP trailers (headers but at the end of the message) to the message.
24962496
2497- Trailers are ** only** be emitted if the message is chunked encoded. If not,
2498- the trailer will be silently discarded.
2497+ Trailers will ** only** be emitted if the message is chunked encoded. If not,
2498+ the trailers will be silently discarded.
24992499
25002500HTTP requires the ` Trailer ` header to be sent to emit trailers,
2501- with a list of header fields in its value, e.g.
2501+ with a list of header field names in its value, e.g.
25022502
25032503``` js
25042504message .writeHead (200 , { ' Content-Type' : ' text/plain' ,
@@ -2522,7 +2522,7 @@ deprecated:
25222522
25232523> Stability: 0 - Deprecated: Use [ ` outgoingMessage.socket ` ] [ ] instead.
25242524
2525- Aliases of ` outgoingMessage.socket `
2525+ Alias of [ ` outgoingMessage.socket ` ] [ ] .
25262526
25272527### ` outgoingMessage.cork() `
25282528
@@ -2562,22 +2562,22 @@ changes:
25622562
25632563Finishes the outgoing message. If any parts of the body are unsent, it will
25642564flush them to the underlying system. If the message is chunked, it will
2565- send the terminating chunk ` 0\r\n\r\n ` , and send the trailer (if any).
2565+ send the terminating chunk ` 0\r\n\r\n ` , and send the trailers (if any).
25662566
2567- If ` chunk ` is specified, it is equivalent to call
2567+ If ` chunk ` is specified, it is equivalent to calling
25682568` outgoingMessage.write(chunk, encoding) ` , followed by
25692569` outgoingMessage.end(callback) ` .
25702570
2571- If ` callback ` is provided, it will be called when the message is finished.
2572- (equivalent to the callback to event ` finish ` )
2571+ If ` callback ` is provided, it will be called when the message is finished
2572+ (equivalent to a listener of the ` ' finish' ` event).
25732573
25742574### ` outgoingMessage.flushHeaders() `
25752575
25762576<!-- YAML
25772577added: v1.6.0
25782578-->
25792579
2580- Compulsorily flushes the message headers
2580+ Flushes the message headers.
25812581
25822582For efficiency reason, Node.js normally buffers the message headers
25832583until ` outgoingMessage.end() ` is called or the first chunk of message data
@@ -2586,7 +2586,7 @@ packet.
25862586
25872587It is usually desired (it saves a TCP round-trip), but not when the first
25882588data is not sent until possibly much later. ` outgoingMessage.flushHeaders() `
2589- bypasses the optimization and kickstarts the request .
2589+ bypasses the optimization and kickstarts the message .
25902590
25912591### ` outgoingMessage.getHeader(name) `
25922592
@@ -2597,8 +2597,8 @@ added: v0.4.0
25972597* ` name ` {string} Name of header
25982598* Returns {string | undefined}
25992599
2600- Gets the value of HTTP header with the given name. If such a name doesn't
2601- exist in message, it will be ` undefined ` .
2600+ Gets the value of the HTTP header with the given name. If that header is not
2601+ set, the returned value will be ` undefined ` .
26022602
26032603### ` outgoingMessage.getHeaderNames() `
26042604
@@ -2608,8 +2608,8 @@ added: v7.7.0
26082608
26092609* Returns {string\[ ] }
26102610
2611- Returns an array of names of headers of the outgoing outgoingMessage. All
2612- names are lowercase.
2611+ Returns an array containing the unique names of the current outgoing headers.
2612+ All names are lowercase.
26132613
26142614### ` outgoingMessage.getHeaders() `
26152615
@@ -2626,8 +2626,8 @@ object are the header names and the values are the respective header
26262626values. All header names are lowercase.
26272627
26282628The object returned by the ` outgoingMessage.getHeaders() ` method does
2629- not prototypically inherit from the JavaScript Object. This means that
2630- typical Object methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` ,
2629+ not prototypically inherit from the JavaScript ` Object ` . This means that
2630+ typical ` Object ` methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` ,
26312631and others are not defined and will not work.
26322632
26332633``` js
@@ -2670,14 +2670,11 @@ Read-only. `true` if the headers were sent, otherwise `false`.
26702670added: v9.0.0
26712671-->
26722672
2673- Overrides the pipe method of legacy ` Stream ` which is the parent class of
2674- ` http.outgoingMessage ` .
2675-
2676- Since ` OutgoingMessage ` should be a write-only stream,
2677- call this function will throw an ` Error ` . Thus, it disabled the pipe method
2678- it inherits from ` Stream ` .
2673+ Overrides the ` stream.pipe() ` method inherited from the legacy ` Stream ` class
2674+ which is the parent class of ` http.OutgoingMessage ` .
26792675
2680- The User should not call this function directly.
2676+ Calling this method will throw an ` Error ` because ` outgoingMessage ` is a
2677+ write-only stream.
26812678
26822679### ` outgoingMessage.removeHeader(name) `
26832680
@@ -2700,10 +2697,12 @@ added: v0.4.0
27002697-->
27012698
27022699* ` name ` {string} Header name
2703- * ` value ` {string } Header value
2700+ * ` value ` {any } Header value
27042701* Returns: {this}
27052702
2706- Sets a single header value for the header object.
2703+ Sets a single header value. If the header already exists in the to-be-sent
2704+ headers, its value will be replaced. Use an array of strings to send multiple
2705+ headers with the same name.
27072706
27082707### ` outgoingMessage.setTimeout(msesc[, callback]) `
27092708
@@ -2752,8 +2751,7 @@ added:
27522751
27532752* {number}
27542753
2755- This ` outgoingMessage.writableCorked ` will return the time how many
2756- ` outgoingMessage.cork() ` have been called.
2754+ The number of times ` outgoingMessage.cork() ` has been called.
27572755
27582756### ` outgoingMessage.writableEnded `
27592757
@@ -2763,9 +2761,9 @@ added: v12.9.0
27632761
27642762* {boolean}
27652763
2766- Readonly, ` true ` if ` outgoingMessage.end() ` has been called. Noted that
2767- this property does not reflect whether the data has been flush . For that
2768- purpose, use ` message.writableFinished ` instead.
2764+ Is ` true ` if ` outgoingMessage.end() ` has been called. This property does
2765+ not indicate whether the data has been flushed . For that purpose, use
2766+ ` message.writableFinished ` instead.
27692767
27702768### ` outgoingMessage.writableFinished `
27712769
@@ -2775,7 +2773,7 @@ added: v12.7.0
27752773
27762774* {boolean}
27772775
2778- Readonly. ` true ` if all data has been flushed to the underlying system.
2776+ Is ` true ` if all data has been flushed to the underlying system.
27792777
27802778### ` outgoingMessage.writableHighWaterMark `
27812779
@@ -2785,12 +2783,8 @@ added: v12.9.0
27852783
27862784* {number}
27872785
2788- This ` outgoingMessage.writableHighWaterMark ` will be the ` highWaterMark ` of
2789- underlying socket if socket exists. Else, it would be the default
2790- ` highWaterMark ` .
2791-
2792- ` highWaterMark ` is the maximum amount of data that can be potentially
2793- buffered by the socket.
2786+ The ` highWaterMark ` of the underlying socket if assigned. Otherwise, the default
2787+ buffer level when [ ` writable.write() ` ] [ ] starts returning false (` 16384 ` ).
27942788
27952789### ` outgoingMessage.writableLength `
27962790
@@ -2800,8 +2794,7 @@ added: v12.9.0
28002794
28012795* {number}
28022796
2803- Readonly, This ` outgoingMessage.writableLength ` contains the number of
2804- bytes (or objects) in the buffer ready to send.
2797+ The number of buffered bytes.
28052798
28062799### ` outgoingMessage.writableObjectMode `
28072800
@@ -2811,51 +2804,33 @@ added: v12.9.0
28112804
28122805* {boolean}
28132806
2814- Readonly, always returns ` false ` .
2807+ Always ` false ` .
28152808
28162809### ` outgoingMessage.write(chunk[, encoding][, callback]) `
28172810
28182811<!-- YAML
28192812added: v0.1.29
28202813changes:
28212814 - version: v0.11.6
2822- description: add `callback` argument.
2815+ description: The `callback` argument was added .
28232816-->
28242817
28252818* ` chunk ` {string | Buffer}
28262819* ` encoding ` {string} ** Default** : ` utf8 `
28272820* ` callback ` {Function}
28282821* Returns {boolean}
28292822
2830- If this method is called and the header is not sent, it will call
2831- ` this._implicitHeader ` to flush implicit header.
2832- If the message should not have a body (indicated by ` this._hasBody ` ),
2833- the call is ignored and ` chunk ` will not be sent. It could be useful
2834- when handling a particular message which must not include a body.
2835- e.g. response to ` HEAD ` request, ` 204 ` and ` 304 ` response.
2823+ Sends a chunk of the body. This method can be called multiple times.
28362824
2837- ` chunk ` can be a string or a buffer. When ` chunk ` is a string, the
2838- ` encoding ` parameter specifies how to encode ` chunk ` into a byte stream.
2839- ` callback ` will be called when the ` chunk ` is flushed.
2825+ The ` encoding ` argument is only relevant when ` chunk ` is a string. Defaults to
2826+ ` 'utf8' ` .
28402827
2841- If the message is transferred in chucked encoding
2842- (indicated by ` this.chunkedEncoding ` ), ` chunk ` will be flushed as
2843- one chunk among a stream of chunks. Otherwise, it will be flushed as the
2844- body of message.
2845-
2846- This method handles the raw body of the HTTP message and has nothing to do
2847- with higher-level multi-part body encodings that may be used.
2848-
2849- If it is the first call to this method of a message, it will send the
2850- buffered header first, then flush the ` chunk ` as described above.
2851-
2852- The second and successive calls to this method will assume the data
2853- will be streamed and send the new data separately. It means that the response
2854- is buffered up to the first chunk of the body.
2828+ The ` callback ` argument is optional and will be called when this chunk of data
2829+ is flushed.
28552830
28562831Returns ` true ` if the entire data was flushed successfully to the kernel
28572832buffer. Returns ` false ` if all or part of the data was queued in the user
2858- memory. Event ` drain ` will be emitted when the buffer is free again.
2833+ memory. The ` ' drain' ` event will be emitted when the buffer is free again.
28592834
28602835## ` http.METHODS `
28612836
@@ -3542,4 +3517,5 @@ try {
35423517[ `writable.destroy()` ] : stream.md#writabledestroyerror
35433518[ `writable.destroyed` ] : stream.md#writabledestroyed
35443519[ `writable.uncork()` ] : stream.md#writableuncork
3520+ [ `writable.write()` ] : stream.md#writablewritechunk-encoding-callback
35453521[ initial delay ] : net.md#socketsetkeepaliveenable-initialdelay
0 commit comments