Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -5356,7 +5356,7 @@ changes:
- version: v22.0.0
pr-url: https://github.com/nodejs/node/pull/52465
description: Value is changed to 2<sup>53</sup> - 1 on 64-bit
architectures.
architectures, and 2<sup>31</sup> - 1 on 32-bit architectures.
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/35415
description: Value is changed to 2<sup>32</sup> on 64-bit
Expand All @@ -5369,12 +5369,13 @@ changes:

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

On 32-bit architectures, this value currently is 2<sup>30</sup> - 1 (about 1
On 32-bit architectures, this value is equal to 2<sup>31</sup> - 1 (about 2
GiB).

On 64-bit architectures, this value currently is 2<sup>53</sup> - 1 (about 8 PiB).
On 64-bit architectures, this value is equal to [`Number.MAX_SAFE_INTEGER`][]
(2<sup>53</sup> - 1, about 8 PiB).

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

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

Expand Down Expand Up @@ -5519,6 +5520,7 @@ introducing security vulnerabilities into an application.
[`ERR_INVALID_BUFFER_SIZE`]: errors.md#err_invalid_buffer_size
[`ERR_OUT_OF_RANGE`]: errors.md#err_out_of_range
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
[`Number.MAX_SAFE_INTEGER`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
[`String.prototype.indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf
[`String.prototype.lastIndexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf
[`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length
Expand All @@ -5541,7 +5543,7 @@ introducing security vulnerabilities into an application.
[`buffer.constants.MAX_STRING_LENGTH`]: #bufferconstantsmax_string_length
[`buffer.kMaxLength`]: #bufferkmaxlength
[`util.inspect()`]: util.md#utilinspectobject-options
[`v8::TypedArray::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1TypedArray.html#a54a48f4373da0850663c4393d843b9b0
[`v8::Uint8Array::kMaxLength`]: https://v8.github.io/api/head/classv8_1_1Uint8Array.html#a7677e3d0c9c92e4d40bef7212f5980c6
[base64url]: https://tools.ietf.org/html/rfc4648#section-5
[endianness]: https://en.wikipedia.org/wiki/Endianness
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
Loading