Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8d8fef0

Browse filesBrowse files
Anton Andesensilverwind
authored andcommitted
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: #5155 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent 40d57b7 commit 8d8fef0
Copy full SHA for 8d8fef0

File tree

Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/stream.markdown‎

Copy file name to clipboardExpand all lines: doc/api/stream.markdown
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.