Skip to content

[QUESTION] How to stream zip without first loading all of it in memory #75

Answered by Touffy
ZefQ asked this question in Q&A
Discussion options

You must be logged in to vote

You won't manage your 40GB download with the Blob approach (but the input generator is a good start). You absolutely have to stream the response (through a Service Worker, because that's the only way).

There's a demo showing one way to do that. You can try it here and the source is also included in the repo. In that demo, client-zip is used in the Service Worker, not the client window.

The window shows a button inside a form with method=POST and action pointing to an arbitrary same-origin URL. Unlike most forms these days, it does not prevent the default action because we want the browser to (try to) navigate to that URL, and we're using a form because it's a good way to add a request pay…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@ZefQ
Comment options

@Touffy
Comment options

Answer selected by Touffy
Comment options

You must be logged in to vote
2 replies
@Touffy
Comment options

@j0sh
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #74 on August 31, 2023 21:11.