Skip to content

🚀 Feature: Improve Storage API by adding streamed responses #745

Open
@joern-h

Description

🔖 Feature description

Currently, getFileView/Download/Preview return byte arrays.
This will force the user to wait for the whole download to be complete, before he gets a response from the client call.
Also, the whole file will be held in RAM.

Previously, i ran into issues downloading big files: appwrite/sdk-for-android#44

Here are some pros for this feature:

  1. Reduced Memory Usage:
    Streaming allows data to be processed in smaller chunks rather than loading the entire content into memory.
  2. Handling Large Files:
    Streaming is particularly useful for handling large files, such as videos or high-resolution images. It allows applications to start playing or displaying content without waiting for the entire file to be downloaded

🎤 Pitch

I see two possible ways to implement this feature:

  1. Simply replace ByteArray with InputStream -> WILL BREAK COMPATIBILITY
  2. Add three functions, suffixed with "Streamed" for example, enabling users to choose between ByteArray and InputStream without breaking their current implementations."
  3. Make use of generics, allowing the user to specify the return type: getFileDownload<InputStream>() (Maybe not possible for every language)

In my case, i added a new function getFileStream to the Android SDK that returns an InputStream instead of a byte array.
joern-h/sdk-for-android@60d10be

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions