From 2b9f72e12cd50d743638946dad8792891fa4b948 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Fri, 2 Sep 2016 11:47:27 +0200 Subject: [PATCH] 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 --- doc/api/stream.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 02e3a946c025e4..2930333771bff6 100644 --- a/doc/api/stream.md +++ b/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(); }