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 geek committed Sep 26, 2016
1 parent b8b90bb commit 7e87d31
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 7e87d31

Please sign in to comment.