Skip to content

FR: Skip re-downloading files from Storage #9231

Open
@surajbarkale

Description

@surajbarkale

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:

  1. When a file is downloaded, get the value of Etag head field
  2. Save the Etag values as extended attribute (using setxattr()) with XATTR_FLAG_CONTENT_DEPENDENT flag
  3. When the file is downloaded again, get the Etag extended attribute
  4. If the attribute is present, set header If-None-Match to the etag value
  5. 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions