Skip to content

Instantly share code, notes, and snippets.

@examinedliving
Created September 24, 2019 15:28
Show Gist options
  • Select an option

  • Save examinedliving/07511776f6c9ae8ce65e7a88d3f3d226 to your computer and use it in GitHub Desktop.

Select an option

Save examinedliving/07511776f6c9ae8ce65e7a88d3f3d226 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment