FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc: replace allocUnsafe with alloc in examples by ChALkeR · Pull Request #60477 · nodejs/node · GitHub

/ node Public

doc: replace allocUnsafe with alloc in examples - #60477

Open
ChALkeR wants to merge 1 commit into
nodejs:mainfrom
ChALkeR:chalker/allocUnsafe/doc/0
Open

doc: replace allocUnsafe with alloc in examples#60477
ChALkeR wants to merge 1 commit into
nodejs:mainfrom
ChALkeR:chalker/allocUnsafe/doc/0

Conversation

ChALkeR commented Oct 29, 2025
edited
Loading

Copy link
Copy Markdown
Member

Do not needlessly promote allocUnsafe.

Dates back to #4682

While the intention was to make allocUnsafe a code replacement for Buffer constructor, it has also been to let users use Buffer.alloc by default and/or when they are not sure, and optimize with allocUnsafe only when needed and when they ensured that nothing gets leaked (which often requires extra actions e.g. error handling or guards against race conditions)

Most documentation methods should use Buffer.alloc instead of Buffer.allocUnsafe by default in examples

This aligns documentation accents internally with the wording in this intent:

node/doc/api/buffer.md

Lines 5066 to 5067 in dec0213

> Stability: 0 - Deprecated: Use [`Buffer.alloc()`][] instead (also see
> [`Buffer.allocUnsafe()`][]).

And https://nodejs.org/docs/latest/api/buffer.html#bufferfrom-bufferalloc-and-bufferallocunsafe

nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. labels Oct 29, 2025
ChALkeR changed the title doc: do not needlessly promote allocUnsafe doc: replace allocUnsafe with alloc in examples Oct 29, 2025

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

github-actions Bot added the stale label Jul 28, 2026
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

Labels

buffer Issues and PRs related to the buffer subsystem. doc Issues and PRs related to the documentations. stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL