Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrey Pechkurov <apechkurov@gmail.com>2020-10-07 17:05:39 +0300
committerMyles Borins <mylesborins@github.com>2020-10-14 23:24:45 +0300
commit0c877762ea37ab08b11cd242a01356629263a323 (patch)
treef29501c536ebfc9fb291135125c088b1fee91f9e /doc
parent16c17ddd883ab9cc925ddbfa9f177f06d3022619 (diff)
doc: document Buffer.concat may use internal pool
PR-URL: https://github.com/nodejs/node/pull/35541 Refs: https://github.com/nodejs/node/pull/32703 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Harshitha K P <harshitha014@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/buffer.md10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md
index 015f87a169c..9240f1c53a3 100644
--- a/doc/api/buffer.md
+++ b/doc/api/buffer.md
@@ -386,9 +386,9 @@ A `TypeError` will be thrown if `size` is not a number.
The `Buffer` module pre-allocates an internal `Buffer` instance of
size [`Buffer.poolSize`][] that is used as a pool for the fast allocation of new
`Buffer` instances created using [`Buffer.allocUnsafe()`][],
-[`Buffer.from(array)`][], and the deprecated `new Buffer(size)` constructor only
-when `size` is less than or equal to `Buffer.poolSize >> 1` (floor of
-[`Buffer.poolSize`][] divided by two).
+[`Buffer.from(array)`][], [`Buffer.concat()`][], and the deprecated
+`new Buffer(size)` constructor only when `size` is less than or equal
+to `Buffer.poolSize >> 1` (floor of [`Buffer.poolSize`][] divided by two).
Use of this pre-allocated internal memory pool is a key difference between
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
@@ -560,6 +560,9 @@ console.log(bufA.length);
// Prints: 42
```
+`Buffer.concat()` may also use the internal `Buffer` pool like
+[`Buffer.allocUnsafe()`][] does.
+
### Static method: `Buffer.from(array)`
<!-- YAML
added: v5.10.0
@@ -3276,6 +3279,7 @@ introducing security vulnerabilities into an application.
[`Buffer.alloc()`]: #buffer_static_method_buffer_alloc_size_fill_encoding
[`Buffer.allocUnsafe()`]: #buffer_static_method_buffer_allocunsafe_size
[`Buffer.allocUnsafeSlow()`]: #buffer_static_method_buffer_allocunsafeslow_size
+[`Buffer.concat()`]: #buffer_static_method_buffer_concat_list_totallength
[`Buffer.from(array)`]: #buffer_static_method_buffer_from_array
[`Buffer.from(arrayBuf)`]: #buffer_static_method_buffer_from_arraybuffer_byteoffset_length
[`Buffer.from(buffer)`]: #buffer_static_method_buffer_from_buffer