Skip to content

doc: document Buffer encoding-specific Slice and Write methods - #65209

Open
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:doc/buffer-encoding-slice-write
Open

doc: document Buffer encoding-specific Slice and Write methods#65209
zeexzeex wants to merge 1 commit into
nodejs:mainfrom
zeexzeex:doc/buffer-encoding-slice-write

Conversation

@zeexzeex

@zeexzeex zeexzeex commented Aug 11, 2026

Copy link
Copy Markdown

Description

Document the long-standing encoding-specific Buffer.prototype.*Slice() and *Write() methods in doc/api/buffer.md.

These APIs have been public but undocumented. Maintainer discussion on #46467 favored documenting them (rather than leaving them undocumented), with a recommendation that callers prefer [buf.toString()][] / [buf.write()][] in the common case.

This revisits the approach from closed #48041, with corrected examples/signatures and clearer notes for binary-to-text *Write methods (input is encoding text to decode, matching buf.write(..., encoding)).

Fixes: #46467

Test plan

  • Ran the documented examples against current Node and verified printed values
  • CI / doc lint on this PR

Document the long-standing *Slice() and *Write() helpers on
Buffer.prototype in buffer.md, noting equivalence to toString()/write()
and that general callers should prefer those APIs.

Fixes: nodejs#46467

Signed-off-by: Avocado <ujubongbong@gmail.com>
@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 Aug 11, 2026
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.

Undocumented buffer.***Slice() methods

2 participants