Live data from Hacker News

JSZip: Create, read and edit .zip files with JavaScript

stuk.github.io

1–10 of 57 posts

Re: JSZip: Create, read and edit .zip files with JavaScript

#2
>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you.

... Am I not understanding what they're saying here or do the authors really not understand how the internet works?

It looks to me like they're saying "don't bother letting your users download zip files. Save your bandwidth! Just get them to send themselves a zip file, client-side!"

Re: JSZip: Create, read and edit .zip files with JavaScript

#3
post #2

>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you. ... Am I not understanding what they're saying here or do the authors really not understand how the internet works? It looks to me like they're saying "don't bother letting your users download zip…

It seems that the data to be zipped is also on the client side (e.g. a color scheme designer tool that wants to bundle some css files and a background image). If the alternative is sending the uncompressed data back to the server and having the server bundle them up into a zip, this approach saves bandwidth.

Re: JSZip: Create, read and edit .zip files with JavaScript

#4
post #2

>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you. ... Am I not understanding what they're saying here or do the authors really not understand how the internet works? It looks to me like they're saying "don't bother letting your users download zip…

Well, if you have a JS app, then it's likely the content the user wants to generate is already in their browser. So you could generate a zip locally and "download" it locally, without any network traffic at all.

Re: JSZip: Create, read and edit .zip files with JavaScript

#5
post #2

>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you. ... Am I not understanding what they're saying here or do the authors really not understand how the internet works? It looks to me like they're saying "don't bother letting your users download zip…

[deleted]

Re: JSZip: Create, read and edit .zip files with JavaScript

#6
post #2

>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you. ... Am I not understanding what they're saying here or do the authors really not understand how the internet works? It looks to me like they're saying "don't bother letting your users download zip…

Consider something like bootstrap, which allows you to customize your download before sending you a zip file.

The assets are already loaded (since you're viewing the bootstrap demo page), so instead of making a request to another server to generate some sort of compressed file for you, that labor is offloaded to the client.

Re: JSZip: Create, read and edit .zip files with JavaScript

#7
post #2

>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you. ... Am I not understanding what they're saying here or do the authors really not understand how the internet works? It looks to me like they're saying "don't bother letting your users download zip…

I'm guessing they mean some kind of situation where the resources you're zipping up have already been downloaded to the user's browser (like a "download as Zip" link for a set of images that are being displayed on the page).

In reality, I don't think there is a good use-case for this as any files that need to be zipped are likely too large for a user's browser to process with JS (it could bog down or crash the browser).

I have a feeling they already realize this though as the example zip file is 237 bytes. If an HTTP header is larger than your zipped file, it probably doesn't need to be zipped/gzipped in the first place.

Re: JSZip: Create, read and edit .zip files with JavaScript

#8
post #2

>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you. ... Am I not understanding what they're saying here or do the authors really not understand how the internet works? It looks to me like they're saying "don't bother letting your users download zip…

Consider something like bootstrap, which allows you to customize your download before sending you a zip file. The assets are already loaded (since you're viewing the bootstrap demo page), so instead of making a request to another server to generate some sort of compressed file for you, that labor is offloaded to the client.

Except you're unnecessarily bogging down the user's browser to a far greater extent (base64 encoding/decoding everything on a possibly underpowered CPU/IO) than the amount of work it would take to do it on the server (pure binary processing on a high end CPU).

I'm guessing Bootstrap can do it because they know most Bootstrap users are developers with decent PCs but for a more mainstream audience, it would be problematic.

Re: JSZip: Create, read and edit .zip files with JavaScript

#9
post #7
post #2

>JavaScript today is capable of generating a lot of data. The easiest way to deliver multiple files to your users is in a zip file. Instead of wasting server resources and bandwidth you can get the client to do it for you. ... Am I not understanding what they're saying here or do the authors really not understand how the internet works? It looks to me like they're saying "don't bother letting your users download zip…

I'm guessing they mean some kind of situation where the resources you're zipping up have already been downloaded to the user's browser (like a "download as Zip" link for a set of images that are being displayed on the page). In reality, I don't think there is a good use-case for this as any files that need to be zipped are likely too large for a user's browser to process with JS (it could bog down or crash the browse…

[deleted]

Re: JSZip: Create, read and edit .zip files with JavaScript

#10
Potential use case: instead of using CSS sprite maps (putting all of your images into one image to reduce the number of http requests generated by your page, then using css magic to select regions inside of that image), image files could be zipped into an image package that is delivered to the client, who unzips it and uses the images inside. This would cut down on the number of requests made, but allow the images to be used as normal images instead of as images within a sprite sheet.
Post reply on HN