code: function arrayToBuffer(arr) {
      if (arr instanceof ArrayBuffer) {
          return arr;
      }
      var ab = arr.buffer;
      if (arr.byteOffset === 0 && arr.byteLength === ab.byteLength) {
          return ab;
      }
      return arr.buffer.slice(arr.byteOffset, arr.byteOffset + arr.byteLength);
  }
docs: Converts byte array to array buffer
  @param {Uint8Array|ArrayBuffer} arr
  @returns {ArrayBuffer}