-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: general improvements to string_decoder.md copy #6940
Conversation
## Class: StringDecoder | ||
When a `Buffer` instance is written to the `StringDecoder` instance, an | ||
internal buffer is used to ensure that the decoded string does not contain | ||
any partial multibyte-characters. These are held in the buffer until the |
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.
tiny nit: multibyte characters
(and I’d maybe call them incomplete
instead of partial
but that’s certainly a question of personal taste)
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.
done
nits addressed! |
LGTM! |
|
||
### decoder.end() | ||
### stringDecoder.end() |
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.
Actually end()
can accept a Buffer
just like write()
. In that case, .write(buffer)
is called first before adding any replacement characters.
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.
Good point! I'd forgotten about that and it wasn't previously documented.
@mscdex ... updated! I updated the example also to show a Buffer being passed to |
@@ -50,15 +50,20 @@ added: v0.1.99 | |||
|
|||
Creates a new `StringDecoder` instance. | |||
|
|||
### stringDecoder.end() | |||
### stringDecoder.end(buffer) |
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.
s/buffer/[buffer]/
@mscdex ... done! |
LGTM |
PR-URL: #6940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Brian White <mscdex@mscdex.net>
Landed in 9140b97. Thank you! |
PR-URL: nodejs#6940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Brian White <mscdex@mscdex.net>
PR-URL: #6940 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Brian White <mscdex@mscdex.net>
adding don't land label. Please feel free to backport @jasnell |
Checklist
Affected core subsystem(s)
doc (string_decoder)
Description of change
General improvements to string_decoder.md
@nodejs/documentation