Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2 tasks done
joern-h opened this issue Dec 4, 2023 · 0 comments
Open
2 tasks done

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

joern-h opened this issue Dec 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@joern-h
Copy link

joern-h commented Dec 4, 2023

🔖 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants