Skip to content

fix(upload): Do not read chunks into memory but just stream file chunks - #1153

Merged
susnux merged 1 commit into
mainfrom
fix/do-not-read-chunks-into-memory
Apr 15, 2024
Merged

fix(upload): Do not read chunks into memory but just stream file chunks#1153
susnux merged 1 commit into
mainfrom
fix/do-not-read-chunks-into-memory

Conversation

@susnux

Copy link
Copy Markdown
Contributor

Instead of reading file chunks into memory and then upload those chunks, we should rather just slice the file and stream it for uploading. This prevents browsers to sky rocket the memory consumption.

We no longer need p-limit so drop that dependency.


You can test this by uploading a large file and monitor the process memory of your browser. Please note that Firefox has a browser bug: As long as the dev tools are open the request data is not freed so if you have the dev tools open you will still suffer this issue.

Instead of reading file chunks into memory and then upload those chunks,
we should rather just slice the file and stream it for uploading.
This prevents browsers to sky rocket the memory consumption.
We no longer need p-limit so drop that dependency.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnuxsusnux added bug Something isn't working 3. to review Waiting for reviews labels Apr 12, 2024
@susnux
susnux merged commit 221903f into mainApr 15, 2024
@susnux
susnux deleted the fix/do-not-read-chunks-into-memory branch April 15, 2024 10:25
@susnuxsusnux mentioned this pull request Apr 15, 2024

@skjnldsvskjnldsv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome @susnux !!!!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsbugSomething isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Browser console error net::ERR_OUT_OF_MEMORY when uploading large files

3 participants

@susnux@artonge@skjnldsv