ArrayBuffer is a Javascript data type used to represent a generic, fixed-length binary data buffer.
Questions tagged [arraybuffer]
597 questions
30
votes
2 answers
Create ArrayBuffer from Array (holding integers) and back again
It seems so simple, but I cannot find out how to convert an Array filled with integers to an ArrayBuffer and back again to an Array. There are lots of examples where strings are converted to an ArrayBuffer like for example here.
Using these examples…

Wilt
- 41,477
- 12
- 152
- 203
29
votes
2 answers
How send arraybuffer as binary via Websocket?
I am working on a project with Mozilla Europe. In this project, I use websocket by Worlize (server-side) and Mozilla (client side), Node.js to try to upload files from a client to a server.
My present goal is to send a arraybuffer of the file to the…

Chris
- 299
- 1
- 3
- 4
26
votes
5 answers
How to get binary string from ArrayBuffer?
What is the way to obtain binary string from ArrayBuffer in JavaScript?
I don't want to encode the bytes, just get the binary representation as String.
Thanks in advance!

Orest
- 1,857
- 5
- 19
- 27
24
votes
1 answer
Passing a JS ArrayBuffer or TypedArray to Emscripten w/o Copying
I have a very large ArrayBuffer (or TypedArray) in JavaScript that I want to pass to an emscriptened function. I'd like to pass the raw bytes without incurring a copy.
If my C/C++ function takes an std::string as in:
void processBuffer(std::string…

Adi Shavit
- 16,743
- 5
- 67
- 137
24
votes
5 answers
Converting arraybuffer to string : Maximum call stack size exceeded
This is my code.
var xhr = new XMLHttpRequest();
xhr.open('GET',window.location.href, true);
xhr.responseType = "arraybuffer";
xhr.onload = function(event) {
debugger;
console.log(" coverting array buffer to string ");
…

Suresh Atta
- 120,458
- 37
- 198
- 307
24
votes
7 answers
How to test for equality in ArrayBuffer, DataView, and TypedArray
Is there a way how to test if two JavaScript ArrayBuffers are equal? I would like to write test for message composing method. The only way I found is to convert the ArrayBuffer to string and then compare. Did I miss something?
Following code is…

JirkaV
- 943
- 1
- 10
- 16
19
votes
1 answer
ArrayBuffer vs Blob and XHR2
XHR2 differences states
The ability to transfer ArrayBuffer, Blob, File and FormData objects.
What are the differences between ArrayBuffer and Blob ?
Why should I care about being able to send them over XHR2 ? (I can understand value of File and…

Raynos
- 166,823
- 56
- 351
- 396
19
votes
1 answer
What is the difference between an array and an ArrayBuffer?
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 wondering what Uint8Array is, how it is different, where…

Luke
- 2,038
- 3
- 22
- 46
19
votes
2 answers
Web Audio API append/concatenate different AudioBuffers and play them as one song
I've been playing with the Web Audio API and I'm trying to load multiple parts of a song and append them to a new ArrayBuffer and then use that ArrayBuffer for playing all the parts as one song. In the following example I am using the same song data…

72lions
- 680
- 2
- 7
- 12
16
votes
2 answers
How to get an array from ArrayBuffer?
I have an ArrayBuffer which looks like:
This buffer is placed under variable named myBuffer and what I'm interested in, is to get the Uint8Array from this object.
I tried to loop as:
myBuffer.forEach(function(element) {
…

delux
- 1,694
- 10
- 33
- 64
16
votes
3 answers
Serialize canvas content to ArrayBuffer and deserialize again
I have two canvases, and I want to pass the content of canvas1, serialize it to an ArrayBuffer, and then load it in canvas2. In the future I will send the canvas1 content to the server, process it, and return it to canvas2, but right now I just want…

vtortola
- 34,709
- 29
- 161
- 263
15
votes
1 answer
Which ArrayBufferView
I'm retrieving an ArrayBuffer over XHR and want to save it to the FileSystem API using a FileWriter. The FileWriter expects a Blob and the Blob constructor won't take an ArrayBuffer, it takes an ArrayBufferView.
There are many ArrayBufferViews to…

Matthew
- 11,203
- 9
- 38
- 44
14
votes
2 answers
Convert Seq to ArrayBuffer
Is there any concise way to convert a Seq into ArrayBuffer in Scala?

classicalist
- 235
- 1
- 2
- 10
14
votes
3 answers
Check for an instance of ArrayBufferView?
Background
With a bit of research I've found that, although ArrayBufferView wasn't initially exposed (through [NoInterfaceObject]) there appeared to be broad agreement that it should be, due to my described use case.
Firefox
Chrome
Safari
The…

james
- 4,150
- 2
- 30
- 36
14
votes
1 answer
Most efficient way to do bitwise operations on pairs of elements in two ArrayBuffers in Javascript
I have two Javascript ArrayBuffers; each contains 512 bits of data.
I would like to do an xor comparison of the two arrays and store the results in a third array.
Currently, I am looping over the elements in the buffers. In the code below 'distance'…

freakTheMighty
- 1,172
- 1
- 12
- 27