From 9930b6b825b195e14d8ef8e675c20ef093af4f9e Mon Sep 17 00:00:00 2001 From: Qingyu Deng Date: Tue, 6 Apr 2021 22:49:45 +0800 Subject: [PATCH] doc: update `buffer.constants.MAX_LENGTH` Fixes: https://github.com/nodejs/node/issues/38093 PR-URL: https://github.com/nodejs/node/pull/38109 Reviewed-By: Darshan Sen Reviewed-By: Antoine du Hamel Reviewed-By: James M Snell Backport-PR-URL: https://github.com/nodejs/node/pull/38232 --- doc/api/buffer.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 9240f1c53a385b..9111e552202f49 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -3140,12 +3140,20 @@ added: v8.2.0 #### `buffer.constants.MAX_LENGTH` * {integer} The largest size allowed for a single `Buffer` instance. On 32-bit architectures, this value currently is 230 - 1 (~1GB). -On 64-bit architectures, this value currently is 231 - 1 (~2GB). + +On 64-bit architectures, this value currently is 232 - 1 (~4GB). + +It reflects [`v8::TypedArray::kMaxLength`][] under the hood. This value is also available as [`buffer.kMaxLength`][]. @@ -3314,6 +3322,7 @@ introducing security vulnerabilities into an application. [`buffer.constants.MAX_STRING_LENGTH`]: #buffer_buffer_constants_max_string_length [`buffer.kMaxLength`]: #buffer_buffer_kmaxlength [`util.inspect()`]: util.md#util_util_inspect_object_options +[`v8::TypedArray::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0 [binary strings]: https://developer.mozilla.org/en-US/docs/Web/API/DOMString/Binary [endianness]: https://en.wikipedia.org/wiki/Endianness [iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols