RegEx Get the mime-type from a Base64

• 1 min read

Quite simple but I had to do a bit of trial and error:

let yourImage = 'data:image/jpeg;base64,hghSTHGSVHBj...'
let reg = new RegExp(/data:(.*);base64/gi)
let mime = reg.exec(s)[1]