doc: use Buffer.from() instead of new Buffer()#6367
Closed
JacksonTian wants to merge 1 commit intonodejs:masterfrom
Closed
doc: use Buffer.from() instead of new Buffer()#6367JacksonTian wants to merge 1 commit intonodejs:masterfrom
JacksonTian wants to merge 1 commit intonodejs:masterfrom
Conversation
Use new API of Buffer to developers in most documents.
| // Note: Converting a Buffer containing an orphan surrogate to a String | ||
| // currently works, but converting a String to a Buffer (via `new Buffer`, or | ||
| // Buffer#write) will replace incomplete surrogates with the unicode | ||
| // currently works, but converting a String to a Buffer (via `Buffer.from()`, |
Member
There was a problem hiding this comment.
Should it be better that we keep the same writing style as afterwards Buffer#write and use Buffer#from here ?
Member
There was a problem hiding this comment.
Buffer#write is used as a shortcut for Buffer.prototype.write, so it’s something you can call on a Buffer instance. Buffer.from() however needs to be called on the global Buffer object (just as it is written). So, no, it is correct to leave these as they are.
Contributor
|
LGTM |
1 similar comment
Member
|
LGTM |
7da4fd4 to
c7066fb
Compare
Member
|
LGTM |
Contributor
Author
|
Landed in e556dd3 |
JacksonTian
added a commit
that referenced
this pull request
Apr 27, 2016
Use new API of Buffer to developers in most documents. PR-URL: #6367 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Fishrock123
pushed a commit
that referenced
this pull request
May 4, 2016
Use new API of Buffer to developers in most documents. PR-URL: #6367 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
This was referenced May 4, 2016
Contributor
|
I do not believe this api exists on v4.x. please correct me if I am wrong |
Contributor
Author
|
new API of Buffer not on v4.x. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist
Affected core subsystem(s)
doc
Description of change
Use new API of Buffer to developers in most documents.