0

I'm looking to build a PWA for offline view of videos and music. I would like to store about (at least) 200-500 MB of data? Is this possible? Having read about browser quotas, i got confused. I'm talking about a normal android device of about 32 to 64 GB of internal storage.

And does this data expire? And can this data be accessible through normal file managers? The Native file system API do satisfy my needs but isn't it still in draft?

Akshay K Nair
  • 1,107
  • 16
  • 29
  • There are a number of different options, outlined in https://web.dev/storage-for-the-web/. Do you _want_ the data to be accessible through normal file managers, or not? – Jeff Posnick Jun 15 '20 at 19:24
  • Yes, I want them to be available to file managers. I want the web page to act like a file manager (access a folder, download to a folder). I saw MEGA cloud storage managing big files in cache of the browser. Something like that, but doesn't expire. – Akshay K Nair Jun 23 '20 at 05:53

2 Answers2

1

You can use Cloud Firestore and store your videos as firebase.firestore.Blob. You can enable offlinePersistance and these documents will be available even offline (you need to access them once though to download them).

Firestore creates an IndexedDb for you out of the box. You can set a specific threshold (default 40MB), if you pass that limit, Firestore will prune older documents. The benefit of this approach is that you can build a proof of concept and try it in a matter of an hour.

Francesco
  • 9,947
  • 7
  • 67
  • 110
  • 1
    As mentioned on a previous previous response "unless you're storing fairly small icons, Don't do this." https://stackoverflow.com/a/49266770/4982169 Could use indexDb but need a custom implementation – Victor Dias Dec 23 '20 at 15:23
1

It's still an experimental "origin trial", but it sounds like the Native File System API will give you the functionality that you're looking for.

In particular, it will let you read/write videos and music to the local file system in a way that will expose them to file managers.

Jeff Posnick
  • 53,580
  • 14
  • 141
  • 167