Skip to content

Commit 174fec5

Browse files
author
Anton Andesen
committed
Update docs for a case with a binary safe string reading
`readable.setEncoding(null)` - may be the most preferable way to proxy a binary data without any encoding/decoding overhead
1 parent 1124de2 commit 174fec5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/api/stream.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ potentially mangled if you simply pulled the Buffers directly and
416416
called [`buf.toString(encoding)`][] on them. If you want to read the data
417417
as strings, always use this method.
418418

419+
Also you can disable any encoding at all with `readable.setEncoding(null)`.
420+
This approach is very useful if you deal with binary data or with large
421+
multi-byte strings spread out over multiple chunks.
422+
419423
```js
420424
var readable = getReadableStreamSomehow();
421425
readable.setEncoding('utf8');

0 commit comments

Comments
 (0)