pseydtonne: Behold the Operator, speaking into a 1930s headset with its large mouthpiece. (prompt)
[personal profile] pseydtonne
Did you know you can read the contents of a zip file inside Firefox without uncompressing? Some of you will shrug and say "that's so 2007", but I'm speaking to the rest of you.

Let's say you've just downloaded the entire documentation for a major database application. The zip file turns out to be nearly half a gigabyte. The contents are mostly html, which can be compressed easily. You could unzip the big bundle, but it'll take half an hour and more than a gigabyte of space. Bleh.

Firefox lets you run Java Archive (JAR) protocol from the URL line. This protocol can parse a variety of compressed files and treat the contents as normal files. The high-level syntax is:
jar:[url to archive]![path to file]
That exclamation point is important, by the way. That syntax is still a bit obscure, so let me give you an example with a Zip file on a Windows machine.

Remember that Windows uses blackslashes for subdirectories and colons to separate drive mount points, whereas web pages use forward slashes and domain name resolution for the equivalent material. I can tell Firefox that I have a local Windows file by using the prefix "file:///" (note the three slashes) instead of "http://" (just two). Thus a normal local file may be:
file:///C:/accumulant/learning/index.htm
Since we really want to look inside a Zip file for its compressed contents, we need the JAR protocol to wrap around the Zip file. Thus we would tell Firefox:
jar:file:///C:/accumulant/zip/bunchastuff.zip!
Now we can search around as if we were in WinZip or the Windows Zip utility. However I want to read an HTML page inside a subfolder of the 'bunchastuff' Zip file. I just add the subdirectories after the exclamation point as if I were requesting a normal local file:
jar:file:///C:/accumulant/zip/bunchastuff.zip!/something/index.htm
The links within the file will now resolve as expected.

Okay, why is this so great? Because you can bookmark a web page inside a Zip file and never have to waste the time and hard drive space. Then you can grab giant bundles of stuff with only the wait time of downloading, then toss them if they're not the stuff you wanted. You can also keep entire knowledge bases worth of material in a third to half of the space.

There's your work-friendly tip for the day. Now I have to get back to scrutinizing SQL commands and installing software.

Date: 2009-10-28 09:53 pm (UTC)
From: [identity profile] metahacker.livejournal.com
Bizarre. It's like a site in a file.

I'm still not sure what the use is--disk space is pretty cheap these days--but it's cool. I assume it works on .jar files, too?

Date: 2009-10-29 01:27 am (UTC)
From: [identity profile] pseydtonne.livejournal.com
It should, what with the title and all. I haven't tested it though.

They gave me a laptop at work. It's a decently fast machine but it has only 120 GB for hard drive space. So yes, this does come into play for me.

Why are we doing tech support for an application that runs server farms using laptops? I suspect the sales and marketing people have a little too much control over operations.

Date: 2009-11-03 07:16 pm (UTC)
From: [personal profile] miekec
No, in fact, I did not know. Am glad I do now - thanks!

August 2016

S M T W T F S
 123456
78910111213
1415 1617181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 5th, 2026 04:29 am
Powered by Dreamwidth Studios