An ArrayBuffer is more than just a simple array. It contains raw binary data. This is very useful for direct memory manipulation and conserving space.

When you create a normal array, you won't get a proper set of contiguous memory in many cases since arrays can contain any combination of different kinds of objects. This is useful when you have dynamic data and multiple types together (frequently happens in JS) but is not so useful when you know the exact layout of memory that you need.

This also allows you to view the data at the byte level. For example, it's pretty common in binary data formats to have a n byte long identifier number, an m byte long field telling you how many bytes are used for this field, and m' bytes of data that actually makes up the data field.

[ identifier ][ bytes of data ][ data ]

With an ArrayBuffer, you have the option of moving through that data on the byte level by using various Views. A regular array doesn't allow you to move through the data with that level of granularity because no guarantees are made about the memory layout.

Finally, because you are telling the compiler/interpreter exactly how much space you're going to use and exactly how you're going to view it, it can do much more advanced optimizations when working with that data. When iterating through that data, it doesn't have to make calculated leaps through memory. Instead, it knows exactly how far to move ahead in memory to find the next data point.

As for what Uint8Array is, it's a typed array. Essentially, it tells the compiler/interpreter that you will be accessing this data exclusively as 8-bit uints which, again, allows it to make better optimizations. Then you can use standard array indexing on it (arr[0], arr[1], etc.) and you'll be getting back the equivalent uint values out of the array.

TL;DR They take less space when the exact data format is known, allows you to move more exactly through your data and gives the compiler/interpreter greater options for optimization.

Answer from Mike Cluck on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › ArrayBuffer
ArrayBuffer - JavaScript - MDN Web Docs
It is an array of bytes, often referred to in other languages as a "byte array". You cannot directly manipulate the contents of an ArrayBuffer; instead, you create one of the typed array objects or a DataView object which represents the buffer in a specific format, and use that to read and write the contents of the buffer.
🌐
JavaScript.info
javascript.info › tutorial › binary data, files
ArrayBuffer, binary arrays
July 11, 2022 - Let’s eliminate a possible source of confusion. ArrayBuffer has nothing in common with Array: It has a fixed length, we can’t increase or decrease it. It takes exactly that much space in the memory. To access individual bytes, another “view” object is needed, not buffer[index].
Discussions

javascript - What is the difference between an array and an ArrayBuffer? - Stack Overflow
I'm just wondering why everyone uses ArrayBuffer instead of just a normal array, string or stringified JSON for sending messages from the server to the client. Is it more efficient? Also, just won... More on stackoverflow.com
🌐 stackoverflow.com
node.js - Convert a binary NodeJS Buffer to JavaScript ArrayBuffer - Stack Overflow
How can I convert a NodeJS binary buffer into a JavaScript ArrayBuffer? More on stackoverflow.com
🌐 stackoverflow.com
typed arrays: make Buffers and ArrayBuffers interchangeable?
I've updated our typed arrays implementation to be more in line with the Khronos spec and the browser but it's not a change that's unequivocally for the better: Buffers are now cloned i... More on github.com
🌐 github.com
8
February 10, 2013
[NodeJS] What is a buffer, and what is a stream?
A Buffer is an in-memory collection of raw bytes. Specifically in node "a Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap." That's it. Because computers store data in bytes, a simple way to think of a Buffer is to think of it as an array of bytes. In your note of the "point of a Buffer" I believe you were trying to say the following: The point of a Buffer is to simply store anything as an array of bytes. The reason this is important is because every thing in computing communicates in bytes. In javascript a String is a collection of characters in UTF16 encoding. Under UTF16 encoding a single character may consist of multiple bytes (at least one, usually not more than four). To help convert between Strings and Buffers the Buffer class has various means to set its encoding so you can put a String into the buffer and it will translate from a String of UTF16 characters into an array of bytes. Once you have a String in byte form you can use it in computing communication. Now, with regard to Streams it is best to think of a Stream as an established connection to some input, some output, or both. A lot of things can muddy this definition of stream, but that is the fundamental idea... A connection to some input or some output or some I/O endpoint that can handle both input and output. For example, one might have a readable stream to a file that one wants to get the contents of. In this case the stream is an input connection to the file. The input stream doesn't hold the contents of the file, but rather holds the connection to the file. It is up to the program to then read and store the contents if that is the desired operation. One place a stream might store the content is into a Buffer object. Input streams in node are called Readable streams and you use them to get data from something. Output streams are called Writable streams and you use them to put data to something. A stream that supports both input and output is called a Duplex stream in node. A fourth type of stream, the Transform stream exists as well, but that's way outside the scope of this. And to tie it back to Buffer, a Buffer is what you get from or put to a Stream. The stream then reads or writes the buffer to the input or output target that the Stream is connected to. More on Buffer here: http://nodejs.org/api/buffer.html More on Stream here: http://nodejs.org/api/stream.html And most important of all, if you want a great way to learn more about Streams check out nodeschool's excellent Stream Adventure exercises: https://github.com/substack/stream-adventure More on reddit.com
🌐 r/learnjavascript
2
6
September 25, 2014
🌐
Webdevtutor
webdevtutor.net › blog › javascript-buffer-vs-arraybuffer
JavaScript Buffer vs ArrayBuffer: Understanding the Differences
This can be both advantageous and risky, as it allows for efficient data manipulation but also requires careful handling to avoid unexpected changes. On the other hand, ArrayBuffer is a built-in object in JavaScript that represents a fixed-length raw binary data buffer.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › what-is-the-difference-between-an-array-and-an-arraybuffer
What is the Difference Between an Array and an ArrayBuffer? - GeeksforGeeks
July 23, 2025 - An ArrayBuffer is a low-level binary data buffer. It is used to handle raw binary data and is primarily used in the scenarios where you need to work with the streams of binary data such as in WebSockets or when manipulating data from the files.
🌐
CodeForGeek
codeforgeek.com › home › node.js buffer vs arraybuffer: the senior engineer’s guide to binary data in 2026
Node.js Buffer vs ArrayBuffer: The Senior Engineer's Guide to Binary Data in 2026 | CodeForGeek
April 15, 2026 - The short answer is this: ArrayBuffer is the web standard for binary data that works in browsers and Node.js, but Buffer is Node.js-specific and gives you performance advantages for I/O-heavy operations.
🌐
Restack
restack.io › p › javascript-ai-search-optimization-techniques-answer-buffer-vs-arraybuffer-cat-ai
Where teams design, test and optimize agents at Enterprise Scale — Restack
April 26, 2025 - The open-source stack enabling teams to improve their agent experience while engineers make them reliable at scale on Kubernetes.
Top answer
1 of 1
41

An ArrayBuffer is more than just a simple array. It contains raw binary data. This is very useful for direct memory manipulation and conserving space.

When you create a normal array, you won't get a proper set of contiguous memory in many cases since arrays can contain any combination of different kinds of objects. This is useful when you have dynamic data and multiple types together (frequently happens in JS) but is not so useful when you know the exact layout of memory that you need.

This also allows you to view the data at the byte level. For example, it's pretty common in binary data formats to have a n byte long identifier number, an m byte long field telling you how many bytes are used for this field, and m' bytes of data that actually makes up the data field.

[ identifier ][ bytes of data ][ data ]

With an ArrayBuffer, you have the option of moving through that data on the byte level by using various Views. A regular array doesn't allow you to move through the data with that level of granularity because no guarantees are made about the memory layout.

Finally, because you are telling the compiler/interpreter exactly how much space you're going to use and exactly how you're going to view it, it can do much more advanced optimizations when working with that data. When iterating through that data, it doesn't have to make calculated leaps through memory. Instead, it knows exactly how far to move ahead in memory to find the next data point.

As for what Uint8Array is, it's a typed array. Essentially, it tells the compiler/interpreter that you will be accessing this data exclusively as 8-bit uints which, again, allows it to make better optimizations. Then you can use standard array indexing on it (arr[0], arr[1], etc.) and you'll be getting back the equivalent uint values out of the array.

TL;DR They take less space when the exact data format is known, allows you to move more exactly through your data and gives the compiler/interpreter greater options for optimization.

Find elsewhere
🌐
Medium
medium.com › @naveenkumarasinghe › javascript-lost-in-binaries-buffer-blob-uint8array-arraybuffer-ed8d2b4de44a
JavaScript: Lost in binaries — Buffer/Blob/UInt8Array/ArrayBuffer | by Naveen Kumarasinghe | Medium
April 2, 2023 - In summary, ArrayBuffer, Uint8Array, ... data. ArrayBuffer provides a fixed-size block of memory that can be manipulated with binary data, while Uint8Array provides a view into that memory for more efficient manipulation...
🌐
Medium
dev-aditya.medium.com › buffer-arraybuffer-float64array-in-node-js-ef68c112d905
Buffer, ArrayBuffer, Float64Array in Node.js | by Aditya Yadav | Medium
September 29, 2024 - Buffer: Specialized for handling binary data in Node.js applications. ArrayBuffer: A low-level binary data buffer used across different environments.
🌐
Node.js
nodejs.org › api › buffer.html
Buffer | Node.js v26.10.0 Documentation
This creates a view of the <ArrayBuffer> without copying the underlying memory. For example, when passed a reference to the .buffer property of a <TypedArray> instance, the newly created Buffer will share the same allocated memory as the <TypedArray>'s underlying ArrayBuffer.
Author: nodejs
🌐
Medium
medium.com › @conboys111 › arraybuffer-vs-standard-arrays-when-and-why-should-you-use-it-cd2891394fab
ArrayBuffer vs Standard Arrays: When and Why Should You Use It? | by myHotTake | Medium
January 18, 2025 - Efficiency: Instead of creating multiple small bowls (arrays), I use one large tray (buffer), reducing memory overhead. Interoperability: This is especially useful for working with binary data (e.g., from files or network streams). Control: I can manage how memory is used and precisely interpret it. For example, ArrayBuffer is often used when working with Web APIs like fetch for handling binary files or WebSockets for sending/receiving data.
🌐
GitHub
gist.github.com › miguelmota › 5b06ae5698877322d0ca
Node.js Buffer to ArrayBuffer · GitHub
function toArrayBuffer(buffer) { return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength); } function toBuffer(byteArray) { return Buffer.from(byteArray); }
🌐
W3Schools
w3schools.com › js › js_arraybuffers.asp
JavaScript Array Buffer
An ArrayBuffer is fixed a block of memory, often used to store typed arrays.
🌐
Medium
medium.com › @julienetienne › different-types-of-arrays-in-javascript-and-when-to-use-them-77f7843b71de
Different Types of Arrays in JavaScript + When to Use Them | by Julien Etienne | Medium
February 8, 2024 - An array-buffer is a Generic Raw Binary Data Buffer. Generic: It’s not tied down to a particular data type. It can be used to store any binary data, whether it represents integers, unsigned integers, floats, unsigned floats and strings.
🌐
Quora
quora.com › What-is-the-relationship-between-a-Buffer-and-an-Uint8Array-in-Node-js
What is the relationship between a Buffer and an Uint8Array in Node.js? - Quora
Answer (1 of 3): tldr - Uint8Array is a general-purpose byte-array that’s available in both nodejs and browsers. Buffer is a subclass of Uint8Array that’s only available in nodejs (for historical reasons). both are primarily used for manipulating binary (byte) data. historically, when nodejs ...
🌐
Telerik
telerik.com › blogs › array-buffers-javascript
Array Buffers in JavaScript
October 22, 2025 - In JavaScript, an ArrayBuffer is defined as an object that represents a generic, fixed-length raw binary data buffer. It allows you to work with binary data directly without worrying about character encoding.