examinedliving
9/24/2019 - 3:28 PM

Base64 to Blob (es6)

Base64 to Blob (es6)

const b64toBlob = async (b64Data, contentType = 'application/octet-stream') => {
    const url = `data:${contentType};base64,${b64Data}`;
    const response = await fetch(url);
    const blob = await response.blob();
    return blob;
};

// https://stackoverflow.com/a/36183085/1167442