eli5: Why can’t programs run .zip files although they take just a few seconds to extract?

867 views

Title, really.

In: Technology

6 Answers

Anonymous 0 Comments

It is the same as a book actually. You get a book for your birthday but it is in a nice birthday box. You want to read the book but you have to unwrap it first which only takes a second.

Also the compression methode changes the binary code of the program. A decompression program has to reconstruct the full binary strings of the files inside the ZIP to make it back to the origional state it was before compressing the data.

Anonymous 0 Comments

A zip file is a file. The program has no way to know what it is. If it does, and the programmer decides to support it, then the program could easily read it, decode it and run it.

There are plugins that allow a zip file to look like a disk drive to other programs. Then a program can do exactly what you want.

Anonymous 0 Comments

I think if you wanted you could programm them to be able to. However that would mean that your programm would have to extract the whole zip-file each time it needs one of the contents. Thats a lot of computational power and time wasted. The only benefit of it running off of a zip would be slightly faster integration of that file once, but having to run off a zip would cost you every time you used the program

Anonymous 0 Comments

Many can, and do in fact.

For instance Office documents are .zip files with the content. Both .docx and .odf documents can be renamed to a .zip and extracted. So are Java .jar files. And some others, I’m sure.

Anonymous 0 Comments

It’s like sending your tax return, or a complaint letter, written entirely in shorthand.

Of course the people the other end *could* translate it and then act upon it if they really wanted to. Maybe some would. But it’s not up to them to do so.

A PDF program is expecting a PDF (which is usually already “zipped” inside itself!), not a ZIP. If the programmer decides to write the logic to also open ZIPs, extract them to a temporary location, look for PDFs inside them and then open that PDF from the temporary area, and then clear that all up when you’re “done” with that file, then fine. (Don’t even get into what happens if you have a filetype that you want to modify then save back into the ZIP).

But it’s not necessary, so it almost never happens.

Anonymous 0 Comments

Extracting a .zip file doesn’t take long, but it is fairly complicated. Modern operating systems come with the software to do this built-in, so for the most part you never have to worry. However, programs that might use the contents of a .zip file do not necessarily contain the software to extract them.

Some programs *do* have this ability, and some just ask the operating system to extract it for them automatically. But most programs don’t do this, because the programmer didn’t want to add the extra parts necessary to do it. They may have simply though it wasn’t needed, or they thought it was better not to make their program larger by including something your computer can already do, or they just didn’t want to take the time to do it.

For whatever reason, which depends on the particular program in question, the creator didn’t include this ability.

Taking this a step more in depth, extracting a .zip file is as I mentioned complicated. And whenever it’s done, there are a few choices that need to be made: Do you extract *all* of it? Do you try to extract only the parts you need? Do you save the extracted files somewhere for later? Do you just load them into memory and dump them when you are done? Can your program also *save* files back into the .zip?

The answers to these questions always depend on the type of program. Some programs routinely extract .zip files into memory, use the content, and then just close them without changing it or copying anything. Other programs need to extract, and then modify, and put the newly changed file back. For some programs, doing any of this would cause them to be less efficient, or to take up too much memory.

So in most cases, the programmer just doesn’t want to deal with any of that. They don’t want to decide what happens, especially if it might not be that the user expects, or if it might make certain parts of their program run slowly in a way the user won’t understand.

So instead, they just expect the user to extract the file first, choose where to keep it, and then open the normal file as usual.