Skip to content

Commit

Permalink
doc: improve stream.Writable ctor encoding option docs
Browse files Browse the repository at this point in the history
- 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]>
  • Loading branch information
addaleax authored and jasnell committed Oct 17, 2018
1 parent 4fcfa9d commit 4bd935e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1500,9 +1500,13 @@ changes:
* `highWaterMark` {number} Buffer level when
[`stream.write()`][stream-write] starts returning `false`. **Default:**
`16384` (16kb), or `16` for `objectMode` streams.
* `decodeStrings` {boolean} Whether or not to decode strings into
`Buffer`s before passing them to [`stream._write()`][stream-_write].
* `decodeStrings` {boolean} Whether or not to encode strings as
`Buffer`s before passing them to [`stream._write()`][stream-_write],
using the encoding specified in the [`stream.write()`][stream-write] call.
**Default:** `true`.
* `defaultEncoding` {string} The default encoding that is used when no
encoding is specified as an argument to [`stream.write()`][stream-write].
**Default:** `'utf8'`.
* `objectMode` {boolean} Whether or not the
[`stream.write(anyObj)`][stream-write] is a valid operation. When set,
it becomes possible to write JavaScript values other than string,
Expand Down

0 comments on commit 4bd935e

Please sign in to comment.