ArrayBuffer
A standard JavaScript object representing a block of raw binary memory, which you read and write through a typed array or DataView.
In more detail
You cannot read an ArrayBuffer directly; you wrap it in a view such as a Uint8Array. Several views can share one ArrayBuffer, so a change made through one is visible through the others. ArrayBuffers are transferable, so large binary data can move to a worker without copying.
Example
Small Node.js Buffers are views onto one shared ArrayBuffer taken from the slab pool.Related terms
- TypedArray — An array-like view, such as Uint8Array, that reads and writes numbers of one fixed type in an ArrayBuffer.
- transferable object — An object, such as an ArrayBuffer, ImageBitmap or MessagePort, whose memory can be moved to another thread instead of copied.
- DataView — A JavaScript object for reading and writing numbers of different sizes at any position in an ArrayBuffer, with the byte order chosen on every call.
- Buffer — A Node.js object holding a fixed-length run of raw bytes stored outside the V8 heap; more generally, any memory that holds data on its way somewhere.
- SharedArrayBuffer — A block of raw memory that several threads can read and write at the same time, without copying.
Taught in
- Web Workers: Off-Thread Computation And Structured Clone — Frontend Architecture & Web Platform
- Node.js Process Architecture: Memory & Heap Spaces — Node.js Internals & Backend Services
- Buffer Fundamentals: Slab Allocator & V8 Memory — Node.js Internals & Backend Services
- Binary Data Manipulation: TypedArrays & Endianness — Node.js Internals & Backend Services