Suppose I have ArrayBuffer(90) of one-file, Now I sliced ArrayBuffer into array according to offset of (30).
It will look like this at (Client-1)
[ArrayBuffer(30), ArrayBuffer(30), ArrayBuffer(30)]
I sent this Small chunks to another client2(One by one) where I kept this chunks into Array. ==> var buffer_area=;
So buffer_area will denote like this at client2 :
My dilemma is how to join/merge/append this array of ArrayBuffer
into one whole ArrayBuffer so it will look like ArrayBuffer(90).
Is there any way to do that : Join Array of ArrayBuffer into one whole ArrayBuffer?
Top comments (1)
It was so simple:
var array_of_arraybuffer = [ArrayBuffer(30),[ArrayBuffer(30)]; // Contain sliced ArrayBuffer
Loop Through : Chunk of ArrayBuffer : array_of_arraybuffer (i)
var merged_ab = new Uint16Array(); //In Every ith-iteration
Pull ith element from array of arraybuffer
var tmp = new Uint8Array(merged_ab.byteLength + array_of_arraybuffer[i].byteLength);
tmp.set(new Uint8Array(merged_ab), 0);
tmp.set(new Uint8Array(array_of_arraybuffer[i]), merged_ab.byteLength);
/Check merged_ab.byteLength with array_of_arraybuffer[i] 's total size if it matched then it worked perfectly/