Any tips on creating a ZIP server side and then downloading on client?

Hi there, I have a server method whose aim is to collate a client’s files that are stored on Amazon s3 and then collate them as a ZIP file that can be downloaded from the front end by an admin.

I’ve previously had success handling ZIP creation and download 100% on the front end but I can’t seem to find the right formula when preparing on the server side.

I’m using JSZip and am unsure if I should be returning the promise, a uint8array, a blob etc from the server side. I’m using Meteor fetch to fetch each file in a loop and then unsure if I should be calling the .blob() method on the response.

If anyone has any experience with this or tips, I’d be most grateful, thanks!

Am still interested in how to do this successfully server side but I seem to have had much more joy creating and manipulating the ZIP file on the client

Cannot comment on the jszip implementation details, but generating a zip file is likely to be a rather CPU intensive operation and as such, depending on the number of users you have, might easily lead you into performance issues on the server. If you are able to offload such spikey executions away from your main app servers (either leaving it to client side or perhaps using serverless functions), then that would probably be a good outcome in many cases.


Since your files are already in S3, this is a perfect case for using AWS Lambda (as microservice)
You would need to use something like claudia and claudia-api-builder to build your Lambda API and then you can post into it with your file names and receive back and S3 address for your ZIP.

If you want to go this way and need some help, let me know.


Thank you both for your replies! I think for now I’m reasonably happy with the client-side implementation even though initially I had intended to do it server side. I’m fetching the data from the server and then building the Zip in the browser