nodejs array buffer to buffer
// Step 1: Create an ArrayBuffer from the source Node.js Buffer
const sourceBuffer = Buffer.from('Hello, world!');
const sourceArrayBuffer = sourceBuffer.buffer;
// Step 2: Create a new Node.js Buffer from the ArrayBuffer
const destinationBuffer = Buffer.from(sourceArrayBuffer);
// Optional: Check if the contents are the same
const contentsMatch = Buffer.compare(sourceBuffer, destinationBuffer) === 0;
// Result: The contents of the sourceBuffer are now in the destinationBuffer