0

I have an image saved on firebase that I'd like to convert to base64 and save as base64 in a JSON file. I can't cache because of conditional rendering. I have no problem getting the URL from firebase and even rendering it on the screen, but I don't want to have it download a new copy every single time when I can just save it and get it from my save. Here's my code:

promiseResponse = await storageRef.child("burgerimg.jpg").getDownloadURL()
            .catch(err => handleError(err));
        console.log(promiseResponse)

It returns

https://firebasestorage.googleapis.com/v0/b/my-app-name.appspot.com/o/burgerimg.jpg?alt=media&token=adkjfk3jkl2j3jrklj4324el

Just to re-iterate: what I want to do is get the image from that URL and convert it to base64, then save it to a JSON object.

  • Just to be clear, I know I can just save the URL in a JSON object, but I don't want to download the image every single time I start up firebase. – onTheLamb27 Dec 30 '20 at 20:45
  • You should check this link https://stackoverflow.com/questions/37352884/save-base64-encoded-image-to-firebase-storage – Avni Onur Pehlivan Dec 30 '20 at 20:49

0 Answers0