Closed sky-train closed 6 years ago
Unlike Uint8Array
, Buffer
uses a slice
method that does not copy data but rather returns a view of the original buffer: https://nodejs.org/api/buffer.html#buffer_buf_slice_start_end
So this result seems expected to me.
Thanks!
Closing as answered.
const buf = Buffer.from([1,2,3]); console.log( buf.slice(1,2).buffer );
// display //ArrayBuffer { byteLength: 8192 }