I need to pull a set of arrays, they have values like ' http://example.com/1.png ' and I have to zip and download them when a user click 'download' on the cilent side.
For that part should I do it on server or client side? I found few npm that can do the job but I doubt it should be at the server side, since I can pass my data from db to cilent.
For Server Side:
First You Can Make Use Of A NPM Module Called ADMZIP; And Pack The ZIP TO ADMZIP Object in nodejs side. And Send The Content in response From The Server Side Using ExpressJS(sendFile or download)
For Client Side:
You Can Create A BLOB On The Client Side And Retrieve The Response And Then Download The Content
In the case of zipping files on a frontend(using jszip for example) client probably will download images faster because most modern browsers can have 6 downloads at the same time, but on another hand, it has it's own limitations and issues .
So I would suggest using server-side compression because it's more stable and flexible(using node-zip for example).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.