Skip to content

Commit cf3f75f

Browse files
fmyevanlucas
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 11ed800 commit cf3f75f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/api/stream.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,8 @@ If the `decodeStrings` property is set in the constructor options, then
12731273
indicate the character encoding of the string. This is to support
12741274
implementations that have an optimized handling for certain string
12751275
data encodings. If the `decodeStrings` property is explicitly set to `false`,
1276-
the `encoding` argument can be safely ignored, and `chunk` will always be a
1277-
`Buffer`.
1276+
the `encoding` argument can be safely ignored, and `chunk` will remain the same
1277+
object that is passed to `.write()`.
12781278

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

15101510
```js
15111511
const Readable = require('stream').Readable;

0 commit comments

Comments
 (0)