function insertExif(arrayBuffer, exifArray) {
  var array = toArray(new Uint8Array(arrayBuffer));
  if (array[2] !== 0xFF || array[3] !== 0xE0) {
    return arrayBuffer;
  }
  var app0Length = array[4] * 256 + array[5];
  var newArrayBuffer = [0xFF, 0xD8].concat(exifArray, array.slice(4 + app0Length));
  return new Uint8Array(newArrayBuffer);
}
Insert Exif information into the given array buffer.
@param {ArrayBuffer} arrayBuffer - The array buffer to transform.
@param {Array} exifArray - The Exif information to insert.
@returns {ArrayBuffer} The transformed array buffer.