mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
Convert the Buffer to an ArrayBuffer. The typed_array.buffer property should be an ArrayBuffer to avoid confusion: a Buffer doesn't have a byteLength property and more importantly, its slice() method works subtly different. That means that before this commit: var buf = new Buffer(1); var arr = new Int8Array(buf); assert.equal(arr.buffer, buf); assert(arr.buffer instanceof Buffer); And now: var buf = new Buffer(1); var arr = new Int8Array(buf); assert.notEqual(arr.buffer, buf); assert(arr.buffer instanceof ArrayBuffer);