| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
This pull request has been marked as stale due to 90 days of inactivity. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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
And https://nodejs.org/docs/latest/api/buffer.html#bufferfrom-bufferalloc-and-bufferallocunsafe