Live data from Hacker News

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

stuk.github.io

21–30 of 57 posts

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

#21
post #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…

The crazy thing: in this thread, you are all right. The state of sending multiple files sucks. ZIP is the closest thing we have to a universal standard, if only because Windows refuses to ship with support for anything that is meaningful.

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

#22
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 would be great for my current project. The project is entirely client-side right now, there is 0 server-side component (though certain features in the near future will require a server-side aspect). For what my project is doing, and for the various interpretations of what ZIP can be, having client-side ZIP generation is great.

Just think of all of the container formats that use ZIP with different file extensions. JAR and ePub to be two off the top of my head; I am sure there are plenty more.

The importance is not in compression, it is in container formats.

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

#23
post #15

Earlier quoted context omitted.

Some images formats already come with compression. Also, zip doesn't work with well with binary data. Using CSS to "subscript" into the sprite is a better solution.

Except that the primary utility of zip is usually not its compression. It's the combining of multiple files into one "file". Basically what tar was invented for, but with actual universal support on every OS.

seems like multipart http responses may be pretty close to what we want

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

#25
post #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…

i'm surprised we don't have a cross-browser webarchive concept yet... especially with the emphasis on mobile.

We have a fantastic one based on MIME that is usable by everything except Firefox (however you need to enable some experimental stuff in Chrome).

http://en.wikipedia.org/wiki/MHTML

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

#27
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…

Hi, I'm the author of JSZip. This sentence is kind of awkward. What I meant is that a lot of data is generated in the browser, and traditionally (at least at the time I wrote this library almost 5 years ago) this would involve sending the data back to your server to zip it up and send it back to the user for download. Instead this can all be done client side.

As an example, someone told me about a web app[1] which allows you to create an animated sprite offline. They use JSZip to let you download all the frames in one file.

There's actually an outstanding PR[2] to update the documentation that I still need to review, hopefully that makes things clearer.

[1] http://www.piskelapp.com/ [2] https://github.com/Stuk/jszip/pull/114

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

#28
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.

In fact the bootstrap customizer does indeed use JSZip to create the zipped download! See http://getbootstrap.com/assets/js/customize.min.js

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

#29
post #14

We use jszip for parsing xlsx/xlsm/xlsb files in the browser (Excel 2007+ files are zip files that contain XML or binary files in specific locations): https://github.com/SheetJS/js-xlsx JSZip works well for small files, but unzipping XLSB files larger than 50M seem to cause out of memory issues in Firefox

This project is great, because it's something I never envisioned for the library!

You may want to take a look at the master branch, because we've recently updated our inflate/deflate implementation to use the much faster Pako, https://github.com/nodeca/pako

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

#30
post #25

Earlier quoted context omitted.

i'm surprised we don't have a cross-browser webarchive concept yet... especially with the emphasis on mobile.

We have a fantastic one based on MIME that is usable by everything except Firefox (however you need to enable some experimental stuff in Chrome). http://en.wikipedia.org/wiki/MHTML

i wasn't aware of this, very cool
Post reply on HN