Skip to content

Commit

Permalink
doc: update buffer.constants.MAX_LENGTH
Browse files Browse the repository at this point in the history
Fixes: #38093

PR-URL: #38109
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>

Backport-PR-URL: #38232
  • Loading branch information
Ayase-252 authored and targos committed Apr 24, 2021
1 parent fc8f1b7 commit 9930b6b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3140,12 +3140,20 @@ added: v8.2.0
#### `buffer.constants.MAX_LENGTH`
<!-- YAML
added: v8.2.0
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/32116
description: Value is changed from 2<sup>31</sup> - 1 to
2<sup>32</sup> - 1 on 64-bit architectures.
-->

* {integer} The largest size allowed for a single `Buffer` instance.

On 32-bit architectures, this value currently is 2<sup>30</sup> - 1 (~1GB).
On 64-bit architectures, this value currently is 2<sup>31</sup> - 1 (~2GB).

On 64-bit architectures, this value currently is 2<sup>32</sup> - 1 (~4GB).

It reflects [`v8::TypedArray::kMaxLength`][] under the hood.

This value is also available as [`buffer.kMaxLength`][].

Expand Down Expand Up @@ -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

0 comments on commit 9930b6b

Please sign in to comment.