Open
Description
Feature proposal
- Firebase Component: Storage
When using writeToFile
, a file is alway downloaded fresh from the Storage. In my app, I download a lot of files and most of them are unchanged. Which results in a lot of traffic. I was getting files from S3 previously and used following caching strategy to speed things up:
- When a file is downloaded, get the value of
Etag
head field - Save the
Etag
values as extended attribute (usingsetxattr()
) withXATTR_FLAG_CONTENT_DEPENDENT
flag - When the file is downloaded again, get the
Etag
extended attribute - If the attribute is present, set header
If-None-Match
to the etag value - If server returns
304
, treat it as success
Since the Storage APIs hide the HTTP headers and response codes, I can not implement this strategy in my code. I am proposing to add a option checkEtgBeforeDownload
and implement this algorithm within Firebase SDK.