From ca17f91ba88c66929595cb6546542aa3faea86aa Mon Sep 17 00:00:00 2001 From: Anton Andesen Date: Tue, 9 Feb 2016 08:31:07 +0000 Subject: [PATCH] doc: add note for binary safe string reading `readable.setEncoding(null)` - may be the most preferable way to proxy a binary data without any encoding/decoding overhead PR-URL: https://github.com/nodejs/node/pull/5155 Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- doc/api/stream.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/stream.markdown b/doc/api/stream.markdown index 72b6834a0f2a4c..71f0e7ddf0850e 100644 --- a/doc/api/stream.markdown +++ b/doc/api/stream.markdown @@ -416,6 +416,10 @@ potentially mangled if you simply pulled the Buffers directly and called [`buf.toString(encoding)`][] on them. If you want to read the data as strings, always use this method. +Also you can disable any encoding at all with `readable.setEncoding(null)`. +This approach is very useful if you deal with binary data or with large +multi-byte strings spread out over multiple chunks. + ```js var readable = getReadableStreamSomehow(); readable.setEncoding('utf8');