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

Uploading large files > 10 MB could crash the application #208

Open
nilsreichardt opened this issue Apr 1, 2024 · 0 comments
Open

Uploading large files > 10 MB could crash the application #208

nilsreichardt opened this issue Apr 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@nilsreichardt
Copy link
Owner

Problem

When uploading a file larger than 10MB (actual size depends on device and available RAM), the application may crash.

This is because the entire file is loaded into RAM as a variable.

Possible solution

To avoid loading the whole file, we can use the chunk stream: https://github.com/miguelpruivo/flutter_file_picker/wiki/FAQ#q-how-do-do-i-use-withreadstream. However, Firebase doesn't provide an easy way to upload a file in chunks.

Google Cloud Storage does support uploading a file in chunks: Resumable Uploads:

Use a resumable upload when you are uploading large files or uploading over a slow connection. For example file size limits when using resumable uploads, see Upload size considerations.

https://cloud.google.com/storage/docs/resumable-uploads

Google Cloud Storage gives you a URL. You may be able to use this URL to upload the chunks using one of the following packages:

https://pub.dev/packages/chunked_uploader
https://pub.dev/packages/large_file_uploader
https://pub.dev/packages/upload_largest_files

@nilsreichardt nilsreichardt added the bug Something isn't working label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant