Skip to content

Commit 6fab334

Browse files
lpincaFishrock123
authored andcommitted
doc: fix example in stream doc
Fix cases where `chunk` is a buffer. PR-URL: #8378 Fixes: #8085 Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 8be818e commit 6fab334

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/api/stream.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,8 +1643,8 @@ class MyDuplex extends Duplex {
16431643
_write(chunk, encoding, callback) {
16441644
// The underlying source only deals with strings
16451645
if (Buffer.isBuffer(chunk))
1646-
chunk = chunk.toString(encoding);
1647-
this[kSource].writeSomeData(chunk, encoding);
1646+
chunk = chunk.toString();
1647+
this[kSource].writeSomeData(chunk);
16481648
callback();
16491649
}
16501650

0 commit comments

Comments
 (0)