@@ -2441,8 +2441,8 @@ added: v0.1.17
24412441* Extends: {Stream}
24422442
24432443This class serves as the parent class of [ ` http.ClientRequest ` ] [ ]
2444- and [ ` http.ServerResponse ` ] [ ] . It is an abstract of outgoing message from
2445- the perspective of the participants of HTTP transaction.
2444+ and [ ` http.ServerResponse ` ] [ ] . It is an abstract outgoing message from
2445+ the perspective of the participants of an HTTP transaction.
24462446
24472447### Event: ` 'drain' `
24482448
@@ -2466,7 +2466,7 @@ Emitted when the transmission is finished successfully.
24662466added: v0.11.6
24672467-->
24682468
2469- Emitted when ` outgoingMessage.end ` was called.
2469+ Emitted after ` outgoingMessage.end() ` is called.
24702470When the event is emitted, all data has been processed but not necessarily
24712471completely flushed.
24722472
@@ -2480,11 +2480,11 @@ added: v0.3.0
24802480
24812481Adds HTTP trailers (headers but at the end of the message) to the message.
24822482
2483- Trailers are ** only** be emitted if the message is chunked encoded. If not,
2484- the trailer will be silently discarded.
2483+ Trailers will ** only** be emitted if the message is chunked encoded. If not,
2484+ the trailers will be silently discarded.
24852485
24862486HTTP requires the ` Trailer ` header to be sent to emit trailers,
2487- with a list of header fields in its value, e.g.
2487+ with a list of header field names in its value, e.g.
24882488
24892489``` js
24902490message .writeHead (200 , { ' Content-Type' : ' text/plain' ,
@@ -2506,7 +2506,7 @@ deprecated: v15.12.0
25062506
25072507> Stability: 0 - Deprecated: Use [ ` outgoingMessage.socket ` ] [ ] instead.
25082508
2509- Aliases of ` outgoingMessage.socket `
2509+ Alias of [ ` outgoingMessage.socket ` ] [ ] .
25102510
25112511### ` outgoingMessage.cork() `
25122512
@@ -2546,22 +2546,22 @@ changes:
25462546
25472547Finishes the outgoing message. If any parts of the body are unsent, it will
25482548flush them to the underlying system. If the message is chunked, it will
2549- send the terminating chunk ` 0\r\n\r\n ` , and send the trailer (if any).
2549+ send the terminating chunk ` 0\r\n\r\n ` , and send the trailers (if any).
25502550
2551- If ` chunk ` is specified, it is equivalent to call
2551+ If ` chunk ` is specified, it is equivalent to calling
25522552` outgoingMessage.write(chunk, encoding) ` , followed by
25532553` outgoingMessage.end(callback) ` .
25542554
2555- If ` callback ` is provided, it will be called when the message is finished.
2556- (equivalent to the callback to event ` finish ` )
2555+ If ` callback ` is provided, it will be called when the message is finished
2556+ (equivalent to a listener of the ` ' finish' ` event).
25572557
25582558### ` outgoingMessage.flushHeaders() `
25592559
25602560<!-- YAML
25612561added: v1.6.0
25622562-->
25632563
2564- Compulsorily flushes the message headers
2564+ Flushes the message headers.
25652565
25662566For efficiency reason, Node.js normally buffers the message headers
25672567until ` outgoingMessage.end() ` is called or the first chunk of message data
@@ -2570,7 +2570,7 @@ packet.
25702570
25712571It is usually desired (it saves a TCP round-trip), but not when the first
25722572data is not sent until possibly much later. ` outgoingMessage.flushHeaders() `
2573- bypasses the optimization and kickstarts the request .
2573+ bypasses the optimization and kickstarts the message .
25742574
25752575### ` outgoingMessage.getHeader(name) `
25762576
@@ -2581,8 +2581,8 @@ added: v0.4.0
25812581* ` name ` {string} Name of header
25822582* Returns {string | undefined}
25832583
2584- Gets the value of HTTP header with the given name. If such a name doesn't
2585- exist in message, it will be ` undefined ` .
2584+ Gets the value of the HTTP header with the given name. If that header is not
2585+ set, the returned value will be ` undefined ` .
25862586
25872587### ` outgoingMessage.getHeaderNames() `
25882588
@@ -2592,8 +2592,8 @@ added: v7.7.0
25922592
25932593* Returns {string\[ ] }
25942594
2595- Returns an array of names of headers of the outgoing outgoingMessage. All
2596- names are lowercase.
2595+ Returns an array containing the unique names of the current outgoing headers.
2596+ All names are lowercase.
25972597
25982598### ` outgoingMessage.getHeaders() `
25992599
@@ -2610,8 +2610,8 @@ object are the header names and the values are the respective header
26102610values. All header names are lowercase.
26112611
26122612The object returned by the ` outgoingMessage.getHeaders() ` method does
2613- not prototypically inherit from the JavaScript Object. This means that
2614- typical Object methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` ,
2613+ not prototypically inherit from the JavaScript ` Object ` . This means that
2614+ typical ` Object ` methods such as ` obj.toString() ` , ` obj.hasOwnProperty() ` ,
26152615and others are not defined and will not work.
26162616
26172617``` js
@@ -2654,14 +2654,11 @@ Read-only. `true` if the headers were sent, otherwise `false`.
26542654added: v9.0.0
26552655-->
26562656
2657- Overrides the pipe method of legacy ` Stream ` which is the parent class of
2658- ` http.outgoingMessage ` .
2659-
2660- Since ` OutgoingMessage ` should be a write-only stream,
2661- call this function will throw an ` Error ` . Thus, it disabled the pipe method
2662- it inherits from ` Stream ` .
2657+ Overrides the ` stream.pipe() ` method inherited from the legacy ` Stream ` class
2658+ which is the parent class of ` http.OutgoingMessage ` .
26632659
2664- The User should not call this function directly.
2660+ Calling this method will throw an ` Error ` because ` outgoingMessage ` is a
2661+ write-only stream.
26652662
26662663### ` outgoingMessage.removeHeader(name) `
26672664
@@ -2684,10 +2681,12 @@ added: v0.4.0
26842681-->
26852682
26862683* ` name ` {string} Header name
2687- * ` value ` {string } Header value
2684+ * ` value ` {any } Header value
26882685* Returns: {this}
26892686
2690- Sets a single header value for the header object.
2687+ Sets a single header value. If the header already exists in the to-be-sent
2688+ headers, its value will be replaced. Use an array of strings to send multiple
2689+ headers with the same name.
26912690
26922691### ` outgoingMessage.setTimeout(msesc[, callback]) `
26932692
@@ -2736,8 +2735,7 @@ added:
27362735
27372736* {number}
27382737
2739- This ` outgoingMessage.writableCorked ` will return the time how many
2740- ` outgoingMessage.cork() ` have been called.
2738+ The number of times ` outgoingMessage.cork() ` has been called.
27412739
27422740### ` outgoingMessage.writableEnded `
27432741
@@ -2747,9 +2745,9 @@ added: v12.9.0
27472745
27482746* {boolean}
27492747
2750- Readonly, ` true ` if ` outgoingMessage.end() ` has been called. Noted that
2751- this property does not reflect whether the data has been flush . For that
2752- purpose, use ` message.writableFinished ` instead.
2748+ Is ` true ` if ` outgoingMessage.end() ` has been called. This property does
2749+ not indicate whether the data has been flushed . For that purpose, use
2750+ ` message.writableFinished ` instead.
27532751
27542752### ` outgoingMessage.writableFinished `
27552753
@@ -2759,7 +2757,7 @@ added: v12.7.0
27592757
27602758* {boolean}
27612759
2762- Readonly. ` true ` if all data has been flushed to the underlying system.
2760+ Is ` true ` if all data has been flushed to the underlying system.
27632761
27642762### ` outgoingMessage.writableHighWaterMark `
27652763
@@ -2769,12 +2767,8 @@ added: v12.9.0
27692767
27702768* {number}
27712769
2772- This ` outgoingMessage.writableHighWaterMark ` will be the ` highWaterMark ` of
2773- underlying socket if socket exists. Else, it would be the default
2774- ` highWaterMark ` .
2775-
2776- ` highWaterMark ` is the maximum amount of data that can be potentially
2777- buffered by the socket.
2770+ The ` highWaterMark ` of the underlying socket if assigned. Otherwise, the default
2771+ buffer level when [ ` writable.write() ` ] [ ] starts returning false (` 16384 ` ).
27782772
27792773### ` outgoingMessage.writableLength `
27802774
@@ -2784,8 +2778,7 @@ added: v12.9.0
27842778
27852779* {number}
27862780
2787- Readonly, This ` outgoingMessage.writableLength ` contains the number of
2788- bytes (or objects) in the buffer ready to send.
2781+ The number of buffered bytes.
27892782
27902783### ` outgoingMessage.writableObjectMode `
27912784
@@ -2795,51 +2788,33 @@ added: v12.9.0
27952788
27962789* {boolean}
27972790
2798- Readonly, always returns ` false ` .
2791+ Always ` false ` .
27992792
28002793### ` outgoingMessage.write(chunk[, encoding][, callback]) `
28012794
28022795<!-- YAML
28032796added: v0.1.29
28042797changes:
28052798 - version: v0.11.6
2806- description: add `callback` argument.
2799+ description: The `callback` argument was added .
28072800-->
28082801
28092802* ` chunk ` {string | Buffer}
28102803* ` encoding ` {string} ** Default** : ` utf8 `
28112804* ` callback ` {Function}
28122805* Returns {boolean}
28132806
2814- If this method is called and the header is not sent, it will call
2815- ` this._implicitHeader ` to flush implicit header.
2816- If the message should not have a body (indicated by ` this._hasBody ` ),
2817- the call is ignored and ` chunk ` will not be sent. It could be useful
2818- when handling a particular message which must not include a body.
2819- e.g. response to ` HEAD ` request, ` 204 ` and ` 304 ` response.
2807+ Sends a chunk of the body. This method can be called multiple times.
28202808
2821- ` chunk ` can be a string or a buffer. When ` chunk ` is a string, the
2822- ` encoding ` parameter specifies how to encode ` chunk ` into a byte stream.
2823- ` callback ` will be called when the ` chunk ` is flushed.
2809+ The ` encoding ` argument is only relevant when ` chunk ` is a string. Defaults to
2810+ ` 'utf8' ` .
28242811
2825- If the message is transferred in chucked encoding
2826- (indicated by ` this.chunkedEncoding ` ), ` chunk ` will be flushed as
2827- one chunk among a stream of chunks. Otherwise, it will be flushed as the
2828- body of message.
2829-
2830- This method handles the raw body of the HTTP message and has nothing to do
2831- with higher-level multi-part body encodings that may be used.
2832-
2833- If it is the first call to this method of a message, it will send the
2834- buffered header first, then flush the ` chunk ` as described above.
2835-
2836- The second and successive calls to this method will assume the data
2837- will be streamed and send the new data separately. It means that the response
2838- is buffered up to the first chunk of the body.
2812+ The ` callback ` argument is optional and will be called when this chunk of data
2813+ is flushed.
28392814
28402815Returns ` true ` if the entire data was flushed successfully to the kernel
28412816buffer. Returns ` false ` if all or part of the data was queued in the user
2842- memory. Event ` drain ` will be emitted when the buffer is free again.
2817+ memory. The ` ' drain' ` event will be emitted when the buffer is free again.
28432818
28442819## ` http.METHODS `
28452820
@@ -3498,4 +3473,5 @@ try {
34983473[ `writable.destroy()` ] : stream.md#writabledestroyerror
34993474[ `writable.destroyed` ] : stream.md#writabledestroyed
35003475[ `writable.uncork()` ] : stream.md#writableuncork
3476+ [ `writable.write()` ] : stream.md#writablewritechunk-encoding-callback
35013477[ initial delay ] : net.md#socketsetkeepaliveenable-initialdelay
0 commit comments