Skip to content
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: how to decode buffers extending from Writable #16403

Closed
wants to merge 4 commits into from

Conversation

Projects
None yet
9 participants
@dicearr
Copy link
Contributor

commented Oct 23, 2017

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

doc: howto decode buffers extending from Writable
Improved stream documentation with an example of how to decode buffers
to strings within a custom Writable.

Fixes: #15369
@vsemozhetbyt

This comment has been minimized.

Copy link
Contributor

commented Oct 23, 2017

Hi @dicearr! Thank you for a try to improve the docs.

We lint code fragments in docs (you can run node tools\eslint\bin\eslint.js --rulesdir tools/eslint-rules/ --ext=.md doc from the project root with your branch to check the conformity).

Currently, there are some issues with the linter:

  1. Lack of semicolons.
  2. Spaces between a function (method) name and parentheses.

You can fix them in a new commit or amend the existing one.

@jasnell jasnell requested a review from mcollina Oct 23, 2017

@tniessen

This comment has been minimized.

@tniessen

This comment has been minimized.

Copy link
Member

commented Oct 28, 2017

@mcollina
Copy link
Member

left a comment

LGTM

@mcollina
Copy link
Member

left a comment

LGTM with some nits.


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

This comment has been minimized.

Copy link
@mcollina

mcollina Oct 30, 2017

Member

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();
}
}

This comment has been minimized.

Copy link
@mcollina

mcollina Oct 30, 2017

Member

it would be good to add a quick example on how to use this.

w.write(euro[0]);
w.end(euro[1]);
console.log(w._data); // currency: €

This comment has been minimized.

Copy link
@mcollina

mcollina Oct 31, 2017

Member

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

This comment has been minimized.

@mcollina

This comment has been minimized.

Copy link
Member

commented Oct 31, 2017

CI failures are unrelated, landing.

Thanks for your first contribution @dicearr 🎉 !

@mcollina

This comment has been minimized.

Copy link
Member

commented Oct 31, 2017

Landed as e509db8!

@mcollina mcollina closed this Oct 31, 2017

mcollina added a commit that referenced this pull request Oct 31, 2017

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>

Qard added a commit to ayojs/ayo that referenced this pull request Nov 2, 2017

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>

Qard added a commit to ayojs/ayo that referenced this pull request Nov 2, 2017

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>

@dicearr dicearr deleted the dicearr:docs-stream-decode-buf branch Nov 2, 2017

cjihrig added a commit to cjihrig/node-1 that referenced this pull request Nov 6, 2017

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>

@cjihrig cjihrig referenced this pull request Nov 6, 2017

Merged

v9.1.0 proposal #16851

gibfahn added a commit that referenced this pull request Nov 14, 2017

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>

MylesBorins added a commit that referenced this pull request Nov 14, 2017

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>

@MylesBorins MylesBorins referenced this pull request Nov 21, 2017

Merged

v6.12.1 proposal #17180

@gibfahn gibfahn referenced this pull request Nov 21, 2017

Merged

v8.9.2 proposal #17204

addaleax added a commit to ayojs/ayo that referenced this pull request Dec 7, 2017

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 7, 2018

doc: howto decode buffers extending from Writable
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 <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.