Offline caching with Firebase Storage

#1

I’m building an app where the user can take photos which will be uploaded to Firebase Storage for backup.

I’m trying to figure out the best way to do this so the user doesn’t have to re-download the images every single time they open the app.

So I need some sort of way to cache the images and I’d like to know what approach people have taken.

I was thinking of maybe just storing the images taken in AsyncStorage but then I would need to somehow implement synchronising it with Firebase cloud storage - so things like if new images for the user come in, I’d need to download it manually, delete it from firebase storage if they delete it from asyncStorage etc.

Is there a better solution to this?

#2

hey @waideveloper, take a look at the Filesystem Api to see if that suits your needs :slight_smile: https://docs.expo.io/versions/latest/sdk/filesystem

#3

Hi quinlanj,

yes I do use this library already to get the file from the camera cache directory. I suppose it is probably better to use FileSystem than to use AsyncStorage as images shouldn’t be stored in a Db.

I was just hoping there was some sort of image caching mechanism within React Native or Expo but it sounds like I would actually need to implement it.

#4

Hello! Does this guide on caching assets for offline support help?

https://docs.expo.io/versions/latest/guides/offline-support#cache-your-assets-after-downloading

closed #5

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.