Skip to content

Commit 5b2ca85

Browse files
fmyMylesBorins
authored andcommitted
doc: fixup errors in stream.md
When decodeStrings is false and given data is string, _write() function receives the string data not `Buffer`. PR-URL: #10411 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 697324e commit 5b2ca85

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/api/stream.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,8 @@ If the `decodeStrings` property is set in the constructor options, then
12711271
indicate the character encoding of the string. This is to support
12721272
implementations that have an optimized handling for certain string
12731273
data encodings. If the `decodeStrings` property is explicitly set to `false`,
1274-
the `encoding` argument can be safely ignored, and `chunk` will always be a
1275-
`Buffer`.
1274+
the `encoding` argument can be safely ignored, and `chunk` will remain the same
1275+
object that is passed to `.write()`.
12761276

12771277
The `writable._write()` method is prefixed with an underscore because it is
12781278
internal to the class that defines it, and should never be called directly by
@@ -1501,9 +1501,9 @@ Implementers, and only from within the `readable._read()` method.
15011501
It is recommended that errors occurring during the processing of the
15021502
`readable._read()` method are emitted using the `'error'` event rather than
15031503
being thrown. Throwing an Error from within `readable._read()` can result in
1504-
expected and inconsistent behavior depending on whether the stream is operating
1505-
in flowing or paused mode. Using the `'error'` event ensures consistent and
1506-
predictable handling of errors.
1504+
unexpected and inconsistent behavior depending on whether the stream is
1505+
operating in flowing or paused mode. Using the `'error'` event ensures
1506+
consistent and predictable handling of errors.
15071507

15081508
```js
15091509
const Readable = require('stream').Readable;

0 commit comments

Comments
 (0)