How can I improve the efficiency of my app's file handling?
Asked by
+AskAgainLater
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.
Answers
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.
Reply to this answer
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.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions