@@ -386,9 +386,9 @@ A `TypeError` will be thrown if `size` is not a number.
386
386
The ` Buffer ` module pre-allocates an internal ` Buffer ` instance of
387
387
size [ ` Buffer.poolSize ` ] [ ] that is used as a pool for the fast allocation of new
388
388
` Buffer ` instances created using [ ` Buffer.allocUnsafe() ` ] [ ] ,
389
- [ ` Buffer.from(array) ` ] [ ] , and the deprecated ` new Buffer(size) ` constructor only
390
- when ` size ` is less than or equal to ` Buffer.poolSize >> 1 ` (floor of
391
- [ ` Buffer.poolSize ` ] [ ] divided by two).
389
+ [ ` Buffer.from(array) ` ] [ ] , [ ` Buffer.concat() ` ] [ ] , and the deprecated
390
+ ` new Buffer(size) ` constructor only when ` size ` is less than or equal
391
+ to ` Buffer.poolSize >> 1 ` (floor of [ ` Buffer.poolSize ` ] [ ] divided by two).
392
392
393
393
Use of this pre-allocated internal memory pool is a key difference between
394
394
calling ` Buffer.alloc(size, fill) ` vs. ` Buffer.allocUnsafe(size).fill(fill) ` .
@@ -560,6 +560,9 @@ console.log(bufA.length);
560
560
// Prints: 42
561
561
```
562
562
563
+ ` Buffer.concat() ` may also use the internal ` Buffer ` pool like
564
+ [ ` Buffer.allocUnsafe() ` ] [ ] does.
565
+
563
566
### Static method: ` Buffer.from(array) `
564
567
<!-- YAML
565
568
added: v5.10.0
@@ -3276,6 +3279,7 @@ introducing security vulnerabilities into an application.
3276
3279
[ `Buffer.alloc()` ] : #buffer_static_method_buffer_alloc_size_fill_encoding
3277
3280
[ `Buffer.allocUnsafe()` ] : #buffer_static_method_buffer_allocunsafe_size
3278
3281
[ `Buffer.allocUnsafeSlow()` ] : #buffer_static_method_buffer_allocunsafeslow_size
3282
+ [ `Buffer.concat()` ] : #buffer_static_method_buffer_concat_list_totallength
3279
3283
[ `Buffer.from(array)` ] : #buffer_static_method_buffer_from_array
3280
3284
[ `Buffer.from(arrayBuf)` ] : #buffer_static_method_buffer_from_arraybuffer_byteoffset_length
3281
3285
[ `Buffer.from(buffer)` ] : #buffer_static_method_buffer_from_buffer
0 commit comments