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

Undocumented buffer.***Slice() methods #46467

Open
jasnell opened this issue Feb 1, 2023 · 3 comments · May be fixed by #48041
Open

Undocumented buffer.***Slice() methods #46467

jasnell opened this issue Feb 1, 2023 · 3 comments · May be fixed by #48041
Labels
buffer Issues and PRs related to the buffer subsystem.

Comments

@jasnell
Copy link
Member

jasnell commented Feb 1, 2023

Buffer has long had a number of undocumented methods like Buffer.prototype.asciiSlice() and Buffer.prototype.utf8Slice()... The question is: should these be documented as part of the public API? Or should public access to them be slowly deprecated and removed?

@anonrig
Copy link
Member

anonrig commented Feb 2, 2023

I'm +1 on deprecating all non public APIs on buffer.

@mscdex
Copy link
Contributor

mscdex commented Feb 2, 2023

-1 I strongly believe we should not remove them. These encoding-prefixed methods (including -Write()), while undocumented, can provide significant speed improvements when you know the encoding ahead of time, allowing you to skip encoding name parsing and various other checks.

If it's any consolation, they could be added to the documentation with the additional recommendation that toString() and write() be used in most/general cases (especially when the encoding is variable) or something to that effect.

@jasnell
Copy link
Member Author

jasnell commented Feb 2, 2023

I'm fine with documenting them. We just shouldn't leave them public and undocumented

@VoltrexKeyva VoltrexKeyva added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. and removed doc Issues and PRs related to the documentations. labels Feb 2, 2023
Xstoudi added a commit to Xstoudi/node that referenced this issue May 16, 2023
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@mscdex @jasnell @anonrig @VoltrexKeyva and others