-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: fix example in stream doc #8378
Conversation
Fix cases where `chunk` is a buffer. PR-URL: nodejs#8378 Fixes: nodejs#8085
chunk = chunk.toString(encoding); | ||
this[kSource].writeSomeData(chunk, encoding); | ||
chunk = chunk.toString(); | ||
this[kSource].writeSomeData(chunk); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assumption here is that encoding
is optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM. I’ll start landing this:
|
Landed in 7f71419 |
Fix cases where `chunk` is a buffer. PR-URL: nodejs#8378 Fixes: nodejs#8085 Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Checklist
Affected core subsystem(s)
doc
Description of change
If
chunk
is a bufferchunk.toString(encoding)
throws an error as'buffer'
is not a valid encoding. This fixes the documentation bug by not using theencoding
argument.Fixes: #8085