Skip to content

Commit 898f236

Browse files
Trotttargos
authored andcommitted
doc: update socket.bufferSize text
Edit text for clarity and readability. PR-URL: #30723 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 489d333 commit 898f236

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

doc/api/net.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -548,19 +548,17 @@ added: v0.3.8
548548

549549
* {integer}
550550

551+
This property shows the number of characters buffered for writing. The buffer
552+
may contain strings whose length after encoding is not yet known. So this number
553+
is only an approximation of the number of bytes in the buffer.
554+
551555
`net.Socket` has the property that `socket.write()` always works. This is to
552556
help users get up and running quickly. The computer cannot always keep up
553557
with the amount of data that is written to a socket. The network connection
554558
simply might be too slow. Node.js will internally queue up the data written to a
555-
socket and send it out over the wire when it is possible. (Internally it is
556-
polling on the socket's file descriptor for being writable).
557-
558-
The consequence of this internal buffering is that memory may grow. This
559-
property shows the number of characters currently buffered to be written.
560-
(Number of characters is approximately equal to the number of bytes to be
561-
written, but the buffer may contain strings, and the strings are lazily
562-
encoded, so the exact number of bytes is not known.)
559+
socket and send it out over the wire when it is possible.
563560

561+
The consequence of this internal buffering is that memory may grow.
564562
Users who experience large or growing `bufferSize` should attempt to
565563
"throttle" the data flows in their program with
566564
[`socket.pause()`][] and [`socket.resume()`][].

0 commit comments

Comments
 (0)