Skip to content

Commit 4bd935e

Browse files
addaleaxjasnell
authored andcommitted
doc: improve stream.Writable ctor encoding option docs
- Document `defaultEncoding`. This was previously undocumented. - Clarify `decodeStrings`. In particular, the previous description was talking about decoding, which matches the unfortunate option name, but what actually happens is usually refererred to as encoding a string into a binary form. PR-URL: #23246 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent 4fcfa9d commit 4bd935e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/stream.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,9 +1500,13 @@ changes:
15001500
* `highWaterMark` {number} Buffer level when
15011501
[`stream.write()`][stream-write] starts returning `false`. **Default:**
15021502
`16384` (16kb), or `16` for `objectMode` streams.
1503-
* `decodeStrings` {boolean} Whether or not to decode strings into
1504-
`Buffer`s before passing them to [`stream._write()`][stream-_write].
1503+
* `decodeStrings` {boolean} Whether or not to encode strings as
1504+
`Buffer`s before passing them to [`stream._write()`][stream-_write],
1505+
using the encoding specified in the [`stream.write()`][stream-write] call.
15051506
**Default:** `true`.
1507+
* `defaultEncoding` {string} The default encoding that is used when no
1508+
encoding is specified as an argument to [`stream.write()`][stream-write].
1509+
**Default:** `'utf8'`.
15061510
* `objectMode` {boolean} Whether or not the
15071511
[`stream.write(anyObj)`][stream-write] is a valid operation. When set,
15081512
it becomes possible to write JavaScript values other than string,

0 commit comments

Comments
 (0)