How do I get the Base64 of a file created with ImageInput

I am using ImageInput with Retool Storage.

I want to get the Base64 so I can create a thumbnail image to store in my database.

I can get the URI which seems to be a local cache of the file before it is uploaded. Can I get the base64 from this somehow? I have tried various methods with fetch, xhr and reader but with no success.

Is there another way to get at the Base64?

One of the things that does work is simply fetching the file from Retool Storage, but that is unneeded network activity if it is already sitting in the browser. This app may be used in poor connectivity areas so I am trying to keep it relatively lightweight.

Try this!

const base64 = await utils.getDataByObjectURL(imageInput1.value[0])