Skip to content

doc: explain hex encoding in Buffer API - #31352

Closed
HarshithaKP wants to merge 4 commits into
nodejs:masterfrom
HarshithaKP:buffer.from_odd_number_characters
Closed

doc: explain hex encoding in Buffer API#31352
HarshithaKP wants to merge 4 commits into
nodejs:masterfrom
HarshithaKP:buffer.from_odd_number_characters

Conversation

@HarshithaKP

Copy link
Copy Markdown
Member

fixes: #29786
refs: #29792
refs: #24491

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Jan 14, 2020
Comment threaddoc/api/buffer.md Outdated
Comment threaddoc/api/buffer.md Outdated
Comment threaddoc/api/buffer.md Outdated
Comment threaddoc/api/buffer.md Outdated
Comment threaddoc/api/buffer.md Outdated
// Prints <Buffer 1a>, data truncated when data ends in single digit ('7').

Buffer.from('1634', 'hex');
// Prints <Buffer 16 34>, fully qualified hexadecimal data

@TrottTrottJan 16, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit: Saying that the data was not truncated might be easier to understand than describing it as fully-qualified.

Suggested change
// Prints <Buffer 16 34>, fully qualified hexadecimal data
// Prints <Buffer 16 34>, all data represented.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott, thanks. Fixed it.

Comment threaddoc/api/buffer.md Outdated
```js
Buffer.from('1ag', 'hex');
// Prints <Buffer 1a>, data truncated when first non-hexadecimal value
// ('g') encountered

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ('g') encountered
// ('g') encountered.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott, ditto.

@Trott

Copy link
Copy Markdown
Member

Landed in e43ee37

@TrottTrott closed this Jan 17, 2020
Trott pushed a commit that referenced this pull request Jan 17, 2020
fixes: #29786
refs: #29792
refs: #24491
PR-URL: #31352Fixes: #29786
Refs: #29792
Refs: #24491
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit that referenced this pull request Feb 17, 2020
fixes: #29786
refs: #29792
refs: #24491
PR-URL: #31352Fixes: #29786
Refs: #29792
Refs: #24491
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@codebyterecodebytere mentioned this pull request Feb 17, 2020
codebytere pushed a commit that referenced this pull request Mar 14, 2020
fixes: #29786
refs: #29792
refs: #24491
PR-URL: #31352Fixes: #29786
Refs: #29792
Refs: #24491
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
codebytere pushed a commit that referenced this pull request Mar 17, 2020
fixes: #29786
refs: #29792
refs: #24491
PR-URL: #31352Fixes: #29786
Refs: #29792
Refs: #24491
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
@codebyterecodebytere mentioned this pull request Mar 17, 2020
@HarshithaKPHarshithaKP mentioned this pull request Apr 1, 2020
2 tasks
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bufferIssues and PRs related to the buffer subsystem.docIssues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buffer.from(string, 'hex') needs a documentation update (was: Buffer.from(x, hex).toString(hex) does not return x for certain values of x)

4 participants

@HarshithaKP@Trott@addaleax@nodejs-github-bot