appwrite / appwrite/sdk-generator
🚀 Feature: Improve Storage API by adding streamed responses
- Dominant language
- Twig
- Stars
- 325
- Forks
- 212
- Avg merge
- 7h 36m
- Merged PRs (30d)
- 91
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: https://github.com/appwrite/sdk-for-android/issues/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()` (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.
https://github.com/joern-h/sdk-for-android/commit/60d10be7567dd67d119e30e252cea690a7cbcb96
### 👀 Have you spent some time to check if this issue has been raised before?
- [X] I checked and didn't find similar issue
### 🏢 Have you read the Code of Conduct?
- [X] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)
Contributor guide
Research direction
Start by tracing the generated getFileView, getFileDownload, and getFilePreview entry points across the SDK templates, then compare the Android getFileStream change linked in the issue. Define a compatible streamed-response approach for the supported SDKs, preserve existing byte-array methods, and verify the generated APIs expose the new option without breaking current callers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100