Browse Source

doc: fix example in stream doc

Fix cases where `chunk` is a buffer.

PR-URL: https://github.com/nodejs/node/pull/8378
Fixes: https://github.com/nodejs/node/issues/8085
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
v6.x
Luigi Pinca 8 years ago
committed by Jeremiah Senkpiel
parent
commit
6fab334a73
  1. 4
      doc/api/stream.md

4
doc/api/stream.md

@ -1643,8 +1643,8 @@ class MyDuplex extends Duplex {
_write(chunk, encoding, callback) {
// The underlying source only deals with strings
if (Buffer.isBuffer(chunk))
chunk = chunk.toString(encoding);
this[kSource].writeSomeData(chunk, encoding);
chunk = chunk.toString();
this[kSource].writeSomeData(chunk);
callback();
}

Loading…
Cancel
Save