Check out example codes for "typescript check if string is base64 or not path to src". It will help you in understanding the concepts better.
Code Example 1
//Check if the string start with 'data:' and it should be a base64 string
string.startsWith("data:"))
Learn ReactJs, React Native from akashmittal.com