How can I retrieve the taken photo file and convert it into a base64 string?

As a developer, I am using Frontline. I want to write some components that can capture photos and convert them into base64 strings, then send them to an API endpoint using a REST request. Can you help me with this?