Skip to content

Commit e283206

Browse files
addaleaxtargos
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 bf17708 commit e283206

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/stream.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1491,9 +1491,13 @@ changes:
14911491
* `highWaterMark` {number} Buffer level when
14921492
[`stream.write()`][stream-write] starts returning `false`. **Default:**
14931493
`16384` (16kb), or `16` for `objectMode` streams.
1494-
* `decodeStrings` {boolean} Whether or not to decode strings into
1495-
`Buffer`s before passing them to [`stream._write()`][stream-_write].
1494+
* `decodeStrings` {boolean} Whether or not to encode strings as
1495+
`Buffer`s before passing them to [`stream._write()`][stream-_write],
1496+
using the encoding specified in the [`stream.write()`][stream-write] call.
14961497
**Default:** `true`.
1498+
* `defaultEncoding` {string} The default encoding that is used when no
1499+
encoding is specified as an argument to [`stream.write()`][stream-write].
1500+
**Default:** `'utf8'`.
14971501
* `objectMode` {boolean} Whether or not the
14981502
[`stream.write(anyObj)`][stream-write] is a valid operation. When set,
14991503
it becomes possible to write JavaScript values other than string,

0 commit comments

Comments
 (0)