Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
doc: how to decode buffers extending from Writable#16403
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
dicearr commented Oct 23, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: #15369
vsemozhetbyt commented Oct 23, 2017 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Hi @dicearr! Thank you for a try to improve the docs. We lint code fragments in docs (you can run Currently, there are some issues with the linter:
You can fix them in a new commit or amend the existing one. |
tniessen commented Oct 28, 2017
tniessen commented Oct 28, 2017
cc @nodejs/documentation |
mcollina left a comment
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
mcollina left a comment
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 with some nits.
doc/api/stream.md Outdated
| Decoding buffers is a common task, for instance, when using transformers whose | ||
| input is a string. This is not a trivial process when using multi-byte | ||
| characters encoding. Implement it within [Writable][] implies some performance |
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.
I would add: "...multi-byte characters encoding, such as UTF-8."
I would remove the sentence "Implement it within Writable implies some performance regressions".
Then:
"The following example shows how to decode multi-byte strings using StringDecoder and Writable."
| this._data+=this._decoder.end(); | ||
| callback(); | ||
| } | ||
| } |
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.
it would be good to add a quick example on how to use this.
doc/api/stream.md Outdated
| w.write(euro[0]); | ||
| w.end(euro[1]); | ||
| console.log(w._data); // currency: € |
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.
can you please rename _data into data? accessing a prefixed property from outside is encouraging to tinker with the stream private properties, which is something we would like to avoid.
mcollina commented Oct 31, 2017
mcollina commented Oct 31, 2017
CI failures are unrelated, landing. Thanks for your first contribution @dicearr 🎉 ! |
mcollina commented Oct 31, 2017
Landed as e509db8! |
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: #15369 PR-URL: #16403 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: nodejs/node#15369 PR-URL: nodejs/node#16403 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: nodejs/node#15369 PR-URL: nodejs/node#16403 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: nodejs#15369 PR-URL: nodejs#16403 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: #15369 PR-URL: #16403 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: #15369 PR-URL: #16403 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: nodejs/node#15369 PR-URL: nodejs/node#16403 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
Improved stream documentation with an example of how to decode buffers
to strings within a custom Writable.
Fixes: #15369
Checklist
Affected core subsystem(s)
doc