ArrayBuffer is not just a simple array. It contains raw binary data. This is very useful for direct memory manipulation and space preservation.
When you create a normal array, in many cases you will not get the proper set of continuous memory, since arrays can contain any combination of different objects. This is useful when you have dynamic data and several types together (often happens in JS), but it is not so useful when you know the exact memory location that you need.
It also allows you to view data at the byte level. For example, quite often in binary data formats there is a long byte identifier, a byte length in bytes indicating how many bytes are used for this field, and m 'bytes of data that actually make up the data field.
[ identifier ][ bytes of data ][ data ]
With ArrayBuffer, you can navigate this data byte level using various views. A regular array does not allow you to navigate through data with this level of detail, because there are no guarantees regarding the layout of the memory.
Finally, since you are telling the compiler / interpreter exactly how much space you are going to use and how exactly you are going to view it, when working with this data it can make much more advanced optimizations. When repeating this data, it is not necessary to calculate jumps through memory. Instead, he knows exactly how far to go in memory to find the next data point.
As for Uint8Array , it is a typed array. Essentially, it tells the compiler / interpreter that you will access this data exclusively as an 8-bit uint , which, again, allows it to improve the optimization. Then you can use the standard indexing of the array on it ( arr[0], arr[1], etc. ), and you will get the return equivalent uint values ββfrom the array.
TL DR They take up less space when the exact data format is known, allows you to navigate your data more accurately, and gives the compiler / interpreter more room for optimization.