This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fetchAsBlob = url => fetch(url) | |
.then(response => response.blob()); | |
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => { | |
const reader = new FileReader; | |
reader.onerror = reject; | |
reader.onload = () => { | |
resolve(reader.result); | |
}; | |
reader.readAsDataURL(blob); |