Skip to content

[Feature request] Expose asset size property without downloading file #1366

@AndreSbro03

Description

@AndreSbro03

Platforms

iOS

Description

I need to access the size of a file that is on iCloud. I don't need the actual file, just the size in bytes. Right now in my app i do something this:

  Future<int> getSize() async {
    File? file = await _ae.originFile;
    if (file == null) return 0;
    return file.lengthSync();
  }

Where _ae is the AssetEntity.

On iOS this download the originFile into the cache folder of my app and by doing that with multiple large assets my app becomes very large very quick. Even if I built a system to clear the cache automatically when the file is not longer needed, is still something that I would like to avoid.

Why

I would like a way to obtain the size in bytes of an asset without downloading the file. For example, AssetEntity could expose a size property or a method that does not trigger a full download.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions