Buffer
Buffer.concat()
Combines byte arrays into new storage in the supplied order. Tested on Node.js 22.16.0. A supplied length can truncate or zero-pad; avoid concatenating unbounded request bodies.
Formal Syntax & Structure
nodejs syntaxnodejs
Buffer.concat(list[, totalLength])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| list | Buffer[] | Uint8Array[] | Chunks in order. |
| totalLength | number | Optional output byte count. |
Return Value
Buffer
Combined bytes.
Working Example
Example Snippetnodejs
import { Buffer } from 'node:buffer';console.log(Buffer.concat([Buffer.from('book'), Buffer.from('s')]).toString());