GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: how to decode buffers extending from Writable by dicearr · Pull Request #16403 · nodejs/node

Conversation

@dicearr

@dicearr dicearr commented Oct 23, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Improved stream documentation with an example of how to decode buffers
to strings within a custom Writable.

Fixes: #15369

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Fixes: #15369
@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to Node.js documentation. stream Issues and PRs related to Node.js streams. labels Oct 23, 2017
@vsemozhetbyt

vsemozhetbyt commented Oct 23, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell
jasnell requested a review from mcollina October 23, 2017 17:24
@dicearr
fix: linting errors in example code
0acc2a3
gireeshpunathil
gireeshpunathil approved these changes Oct 24, 2017
View reviewed changes
@tniessen

tniessen commented Oct 28, 2017

Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/11056/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tniessen

tniessen commented Oct 28, 2017

Copy link
Copy Markdown
Member

cc @nodejs/documentation

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina reviewed Oct 30, 2017
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
benjamingr
benjamingr approved these changes Oct 30, 2017
View reviewed changes
mcollina
mcollina approved these changes Oct 30, 2017
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 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

@mcollina mcollina Oct 30, 2017

Copy link
Copy Markdown
Member

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."

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread doc/api/stream.md
this._data += this._decoder.end();
callback();
}
}

@mcollina mcollina Oct 30, 2017

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dicearr
fix: example usage and text changes
14140cc
mcollina
mcollina reviewed Oct 31, 2017
View reviewed changes
Comment thread doc/api/stream.md Outdated
w.write(euro[0]);
w.end(euro[1]);

console.log(w._data); // currency: €

@mcollina mcollina Oct 31, 2017

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dicearr
fix: renamed _data into data
829d356
@mcollina

mcollina commented Oct 31, 2017

Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-pull-request/11112/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina

mcollina commented Oct 31, 2017

Copy link
Copy Markdown
Member

CI failures are unrelated, landing.

Thanks for your first contribution @dicearr 🎉 !

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina

mcollina commented Oct 31, 2017

Copy link
Copy Markdown
Member

Landed as e509db8!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mcollina mcollina closed this Oct 31, 2017
mcollina pushed a commit that referenced this pull request Oct 31, 2017
@dicearr @mcollina
doc: howto decode buffers extending from Writable
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]>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
@dicearr @Qard
doc: howto decode buffers extending from Writable
b5e1d52
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]>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
@dicearr @Qard
doc: howto decode buffers extending from Writable
eb2163a
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]>
@dicearr
dicearr deleted the docs-stream-decode-buf branch November 2, 2017 08:50
cjihrig pushed a commit to cjihrig/node that referenced this pull request Nov 6, 2017
@dicearr @cjihrig
doc: howto decode buffers extending from Writable
59a4789
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]>
@cjihrig cjihrig mentioned this pull request Nov 6, 2017
v9.1.0 proposal #16851
Merged
@MylesBorins MylesBorins added the dont-land-on-v6.x label Nov 14, 2017
@gibfahn gibfahn added land-on-v8.x and removed dont-land-on-v6.x labels Nov 14, 2017
@MylesBorins MylesBorins added the land-on-v6.x label Nov 14, 2017
gibfahn pushed a commit that referenced this pull request Nov 14, 2017
@dicearr @gibfahn
doc: howto decode buffers extending from Writable
d2e4a87
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]>
MylesBorins pushed a commit that referenced this pull request Nov 14, 2017
@dicearr @MylesBorins
doc: howto decode buffers extending from Writable
3e6da45
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]>
@MylesBorins MylesBorins mentioned this pull request Nov 21, 2017
v6.12.1 proposal #17180
Merged
@gibfahn gibfahn mentioned this pull request Nov 21, 2017
v8.9.2 proposal #17204
Merged
addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
@dicearr @addaleax
doc: howto decode buffers extending from Writable
c0c68bc
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]>
This was referenced May 13, 2024
[Snyk] Security upgrade eslint from 8.22.0 to 8.26.0 leonardoadame/node#818
Open
[Snyk] Fix for 2 vulnerabilities leonardoadame/node#839
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@benjamingr benjamingr benjamingr approved these changes
@gireeshpunathil gireeshpunathil gireeshpunathil approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

doc Issues and PRs related to Node.js documentation. stream Issues and PRs related to Node.js streams.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Document how to use StringDecoder in combination with stream.Transform

Uh oh!

There was an error while loading. Please reload this page.

9 participants

@dicearr @vsemozhetbyt @tniessen @mcollina @benjamingr @gireeshpunathil @MylesBorins @gibfahn @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.