Browse Source

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: https://github.com/nodejs/node/pull/10411
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v7.x
Fumiya KARASAWA 8 years ago
committed by Evan Lucas
parent
commit
cf3f75f6f0
  1. 10
      doc/api/stream.md

10
doc/api/stream.md

@ -1273,8 +1273,8 @@ If the `decodeStrings` property is set in the constructor options, then
indicate the character encoding of the string. This is to support indicate the character encoding of the string. This is to support
implementations that have an optimized handling for certain string implementations that have an optimized handling for certain string
data encodings. If the `decodeStrings` property is explicitly set to `false`, data encodings. If the `decodeStrings` property is explicitly set to `false`,
the `encoding` argument can be safely ignored, and `chunk` will always be a the `encoding` argument can be safely ignored, and `chunk` will remain the same
`Buffer`. object that is passed to `.write()`.
The `writable._write()` method is prefixed with an underscore because it is The `writable._write()` method is prefixed with an underscore because it is
internal to the class that defines it, and should never be called directly by 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.
It is recommended that errors occurring during the processing of the It is recommended that errors occurring during the processing of the
`readable._read()` method are emitted using the `'error'` event rather than `readable._read()` method are emitted using the `'error'` event rather than
being thrown. Throwing an Error from within `readable._read()` can result in being thrown. Throwing an Error from within `readable._read()` can result in
expected and inconsistent behavior depending on whether the stream is operating unexpected and inconsistent behavior depending on whether the stream is
in flowing or paused mode. Using the `'error'` event ensures consistent and operating in flowing or paused mode. Using the `'error'` event ensures
predictable handling of errors. consistent and predictable handling of errors.
```js ```js
const Readable = require('stream').Readable; const Readable = require('stream').Readable;

Loading…
Cancel
Save