Node.js Buffer Concatenate

Introduction

Following is the syntax of the method to concatenate Node buffers to a single Node Buffer:

Buffer.concat(list[, totalLength])

Returns a buffer which is the result of concatenating all the buffers in the list together.

// example//w  w w .java  2  s .  c o m
var buffer1 = Buffer.from('test');
var buffer2 = Buffer.from('Simply Easy Learning');
var buffer3 = Buffer.concat([buffer1,buffer2]);
console.log("buffer3 content: " + buffer3.toString());



PreviousNext

Related