From 756d2e48d8fcbd0dc909e7ad108a495b890c64f1 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 --- doc/api/buffer.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 176e53ffe5177e..e7183121b6daa3 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -3410,12 +3410,24 @@ 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 (~4GB). + +It reflects [`v8::TypedArray::kMaxLength`][] under the hood. This value is also available as [`buffer.kMaxLength`][]. @@ -3585,6 +3597,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 [base64url]: https://tools.ietf.org/html/rfc4648#section-5 [binary strings]: https://developer.mozilla.org/en-US/docs/Web/API/DOMString/Binary [endianness]: https://en.wikipedia.org/wiki/Endianness