zen-fs / core

A filesystem, anywhere
https://zen-fs.github.io/core/
MIT License
68 stars 9 forks source link

`Fetch`: Integration with the Cache API #52

Open james-pre opened 8 months ago

james-pre commented 8 months ago

@billiegoose:

I'm not actually working on this yet (I'm still using IndexedDB in the Service Worker), but I think it would be cool so I'll write this idea down anyway.

It's still experimental, but the Cache API is very cool:

  • it's a key / value store
  • for arbitrary files (no need to serialize/deserialize)
  • supports streaming
  • no fixed size limits (limits are determined by the quota API which is still in development)
  • caches global available in both Window and Service Worker scopes
  • supports quickly downloading and caching a batch of files for offline access via Cache.addAll()

@jvilk:

Sounds nice. I would call it CacheStorageFS instead, since I would like to have some sort of generic caching file system implemented in the future (https://github.com/jvilk/BrowserFS/issues/95).

https://github.com/jvilk/BrowserFS/issues/191

james-pre commented 3 months ago

Looking into the Cache API, it can only cache Requests/Responses. That means it is limited to fetch requests.