rendezvous/www/lib/b64-to-blob.js

15 lines
421 B
JavaScript
Raw Permalink Normal View History

2023-06-21 15:33:47 +00:00
export default async function b64toBlob(b,type){
// https://ionic.io/blog/converting-a-base64-string-to-a-blob-in-javascript
// https://github.com/jeremyBanks/b64-to-blob/blob/master/b64toBlob.js
// size limit?
//console.log({b,type})
const u = `data:${type};base64,${b}`
//console.log({u})
const f = await fetch(u) // this always works?
const blob = await f.blob()
//console.log({blob})
return blob
}//func