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>
This commit is contained in:
parent
4f832ebaf6
commit
7f71419ee4
@ -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…
x
Reference in New Issue
Block a user