Categories
JavaScript Answers

How to append binary data to a buffer in Node.js?

Spread the love

To append binary data to a buffer in Node.js, we call the Buffer.concat method.

For instance, we write

const newBuffer = Buffer.concat([buffer1, buffer2]);

to call Buffer.concat with an array of buffers to return a new buffer that are combined from the buffers in the array.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *