diff options
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r-- | ext/bg/js/util.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 0527dc0b..4c989642 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -155,3 +155,12 @@ function utilReadFile(file) { reader.readAsBinaryString(file); }); } + +function utilReadFileArrayBuffer(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = () => reject(reader.error); + reader.readAsArrayBuffer(file); + }); +} |