covidpass-greenpass-su-ipho.../public/patch-arrayBuffer.js

19 lines
578 B
JavaScript
Raw Normal View History

(function () {
if ('File' in self) {
File.prototype.arrayBuffer = File.prototype.arrayBuffer || myArrayBuffer
}
Blob.prototype.arrayBuffer = Blob.prototype.arrayBuffer || myArrayBuffer;
function myArrayBuffer() {
// this: File or Blob
return new Promise((resolve) => {
let fr = new FileReader();
fr.onload = () => {
resolve(fr.result);
};
fr.readAsArrayBuffer(this);
})
}
})();
// This is a simple trick to implement Blob.arrayBuffer (https://developer.mozilla.org/en-US/docs/Web/API/Blob/arrayBuffer) using FileReader