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.
JSZip: Create, read and edit .zip files with JavaScript
31–40 of 57 posts
Re: JSZip: Create, read and edit .zip files with JavaScript
#32Earlier quoted context omitted.
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 problema…
For most users, bandwidth is in shorter supply than CPU. Especially on mobile (your constrained CPU/IO case), where people are using 3G or worse, which is often even billed by the MB.
Re: JSZip: Create, read and edit .zip files with JavaScript
#33Is this really news? Almost every server side language out there will have a zip library, and I doubt any of those got mentioned on HN.
Re: JSZip: Create, read and edit .zip files with JavaScript
#34Earlier quoted context omitted.
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
#35Earlier 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.
It's not about saving bandwidth or space by compressing the images - it's about removing the step of combining your images into one big image then using coordinates inside of that image to find your original images. Sure, you can build the spriting into your build process, but I don't know how to do that (I'm sure there are tools) and you can't exactly use normal css since the coordinates of your images may change wi…
Re: JSZip: Create, read and edit .zip files with JavaScript
#36Re: JSZip: Create, read and edit .zip files with JavaScript
#37Re: JSZip: Create, read and edit .zip files with JavaScript
#38Potential 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…
CSS Sprites are very easy to make and use. You just need to set the right coordinates for the background-image.
On the other hand, running a complicated JS library and building an infrastructure to extract these images seems like an overkill for something that CSS sprites can do so easily.
Re: JSZip: Create, read and edit .zip files with JavaScript
#39Potential 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
#40Is PSZIp better?