I'm currently trying to figure out whether there's an inefficiency in how my app handles files. Right now, my app retrieves zip files from a server, extracts them, and sends back an array with a single file from each zip to the user. I'm wondering if it would be more efficient to send the entire array of zip files to the client and let the JavaScript on the user's end handle the unzipping instead. Just so you know, these are all small text files.
2 Answers
If your server is already sending gzipped content, using zip files might not help reduce your data transfer. If the unzipping process is causing a bottleneck on the server, then sending the zips to the client could work better. But keep in mind that you might end up adding some latency on the client side. Just be sure to measure the performance trade-offs to see what really makes sense for your situation.
Why are the files zipped in the first place? If you don’t have a database handling your data, maybe consider streaming it over a WebSocket. This way, you'll avoid blocking and can update the client as data comes in, which could make things a lot smoother.
Related Questions
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically
[Centos] Delete All Files And Folders That Contain a String