function getExif(arrayBuffer) {
  var array = toArray(new Uint8Array(arrayBuffer));
  var length = array.length;
  var segments = [];
  var start = 0;
  while (start + 3 < length) {
    var value = array[start];
    var next = array[start + 1];

    // SOS (Start of Scan)
    if (value === 0xFF && next === 0xDA) {
      break;
    }

    // SOI (Start of Image)
    if (value === 0xFF && next === 0xD8) {
      start += 2;
    } else {
      var offset = array[start + 2] * 256 + array[start + 3];
      var end = start + offset + 2;
      var segment = array.slice(start, end);
      segments.push(segment);
      start = end;
    }
  }
  return segments.reduce(function (exifArray, current) {
    if (current[0] === 0xFF && current[1] === 0xE1) {
      return exifArray.concat(current);
    }
    return exifArray;
  }, []);
}
Get Exif information from the given array buffer.
@param {ArrayBuffer} arrayBuffer - The array buffer to read.
@returns {Array} The read Exif information.