Skip to content

Commit

Permalink
doc: fix example in stream doc
Browse files Browse the repository at this point in the history
Fix cases where `chunk` is a buffer.

PR-URL: nodejs#8378
Fixes: nodejs#8085
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
lpinca authored and addaleax committed Sep 24, 2016
1 parent 4f832eb commit 7f71419
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 7f71419

Please sign in to comment.