diff --git a/util/Util.js b/util/Util.js index 0b26f4e..8ce89ca 100644 --- a/util/Util.js +++ b/util/Util.js @@ -10,6 +10,15 @@ class Util { throw new Error("Class may not be instantiated."); } + static downloadAsBuffer(source) { + return new Promise((resolve, reject) => { + fetch(source).then(res => { + if(res.ok) resolve(res.buffer()); + else reject(res.statusText); + }); + }); + } + static readdirRecursive(directory) { const result = [];