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: added Buffer.from(string) to functions that use buffer pool #52801

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Whitecx
Copy link

@Whitecx Whitecx commented May 2, 2024

Buffer.from(string) is one of the functions that may use the pre-allocated buffer. It's mentioned in the description of Buffer.from(array), but not in Buffer.from(string), or in the two other places where functions that behave this way are listed, so this commit adds those references.

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels May 2, 2024
@jasnell
Copy link
Member

jasnell commented May 4, 2024

There appear to be a number of additional commits here that are unrelated to the doc change. Can I ask you to remove the extra commits?

Buffer.from(string) is one of the functions that may use the
pre-allocated buffer. It's mentioned in the description of
Buffer.from(array), but not in Buffer.from(string), or in the two other
places where functions that behave this way are listed, so this commit
adds those references.

formatted changed w/ linter
@Whitecx
Copy link
Author

Whitecx commented May 5, 2024

There appear to be a number of additional commits here that are unrelated to the doc change. Can I ask you to remove the extra commits?

Sorry about that, everything should be cleaned up now.

@Whitecx
Copy link
Author

Whitecx commented May 9, 2024

@jasnell Does this change feel substantive? I wanted to make this PR when I had some time, because I'd used buffer.from(string) and was confused as to why the underlying buffer had other data in it. When I didn't see any explanation in the buffer.from(string) section of the docs, I actually went to the source code and found where the buffer pool was used when creating strings long before I noticed that this behavior was documented at the bottom of buffer.from(array) 😂.

It would've saved me some time had it been in the buffer.from(string) section of the docs, so I thought it might help others as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants