Upload to Firebase Storage in Ionic (without reading into memory)

So reading the cordova-plugin-camera docs it recommends using FILE_URI instead of DATA_URL to get back content from the camera for performance reasons (doesn’t have to keep file contents in memory).

I made changes in my code to do this since I have to upload the file to another service for processing and I managed to use Transfer and File from ionic-native instead of http.post to get me past that part… but once it’s been processed I also need to upload to Firebase Storage.

Has anyone found a way to send an image/file to Firebase that doesn’t read the file into memory? If there isn’t a way, I may as well just read the image as DATA_URL to begin with, create a Blob from that and upload that to this other service and Firebase the same way.

Have a look at the Transfer plugin.

Thanks mirkonasato. As I mentioned I have been able to use the Transfer plugin for uploading to one of the services but can’t figure out how to achieve the same thing for uploading to Firebase with the Web API they have exposed. Firebase has an iOS and Android API available also but I am hoping someone knows a way with the Web API since it’s primarily what I am using with Ionic2.

1 Like

Were you able to resolve this? I am at same decision point, if I have to use memory to convert, might as well use data_url which has been advised not to in many tutorials and courses. There seems to be support for it in storage api calls but haven’t been able to make it work. Thanks for any update you may have.

I did figure it out but it’s been forever since I worked on that project.
Let me see what I can dig up for you.

Thank You, for now I just went with Data_URL option but would love to have better option.

Best Regards
Frank J. Barbato
Third Wave Technology

e. FBarbato@ThirdWave.IT mailto:FBarbato@ThirdWave.IT
p/f. 855-722-3886 ext 701 tel:855-722-3886%20ext%20701
m. 561-707-3791 tel:561-707-3791
w. www.ThirdWave.IT http://www.thirdwave.it/
Follow me on twitter: https://twitter.com/frankjbarbato https://twitter.com/frankjbarbato
[Cour Four Technology, Inc.
DBA Third Wave Technology]

hi awynham,

can u share with me your code to convert data_url to blob to to upload in firebase storage?

thanks in advance