Cache images coming from Firebase Storage

I would like to cache image coming from Firebase Storage but the info online is a bit confusing. A lot of tutorials show the use of Cordova File and Cordova File Transfer. Why not ionic/storage and save the image in base64 using btoa()? Note that the CORS issue from Firebase exists and this is the only way to get around it: https://stackoverflow.com/questions/37760695/firebase-storage-and-access-control-allow-origin/37765371#37765371. Is it possible to cache image from Firebase Storage for apps running in the browser, iOS and Android? Anyone handled this issue?

This is my ionic info.

Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3 ios 4.3.1
Ionic Framework                 : ionic-angular 3.4.0

System:

Node       : v6.10.2
OS         : macOS Sierra
Xcode      : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim    : 5.0.13
npm        : 5.0.3
1 Like

Can we use updateMetaData() for cache: https://firebase.google.com/docs/storage/web/file-metadata

Did you find out any solutions for this thread?

Check out https://firebase.google.com/docs/storage/web/file-metadata. You can set a cache header for the file.