code: function concatArrayBuffers(buffers: ArrayBuffer[]): ArrayBuffer {
    var totalBytes = buffers.map(b => b.byteLength).reduce((a, b) => a + b, 0);
    var output = new Uint8Array(totalBytes);
    var position = 0;
    buffers.forEach(buf => {
      output.set(new Uint8Array(buf), position);
      position += buf.byteLength;
    });
    return output.buffer;
  }
docs: Return a new ArrayBuffer by concatenating an array of ArrayBuffers.