If a .zip file contains all of the information of the original, just in less space, why does it have to be unzipped to access any of it?

780 views

If a .zip file contains all of the information of the original, just in less space, why does it have to be unzipped to access any of it?

In: 1276

43 Answers

Anonymous 0 Comments

If I have the string “0000000000” in a file. The program doing the compression may replace this with a shorthand like “0x10″*. No information was lost, we still know what the original data was. However, *other programs* don’t understand the shorthand the compression algorithm used. They don’t know “0x10” is supposed to mean “0000000000”.

*Obviously, the computer wouldn’t compress it to something human readable like this, but this is just an example.

Anonymous 0 Comments

Think of a lunchbox filled to the brim with all the food, waterbottle, sandwhich, bag of chips ect. How are you gonna open the water and have some without first opening the lunchbox and removing the water in the first place? It takes up more room once you open the box and remove all the food from it, but now you can access it

Anonymous 0 Comments

I’ll try to go for a true ELI5 here. Imagine you have a sheet of paper with stuff written on it (the original information). You crumple it up, so that you can put it in your pocket (as a zip file). Now it takes up much less space and it’s more convenient to move around, despite still having all the information of the original on it. But you can’t read what’s on it, because it’s all crumpled up. You’ll have to unfold it and straighten it out (unzip) in order to be able to read it again.

Anonymous 0 Comments

There is no need to uncompress the data if you just want access to the compressed data, you can open the zip file in for example a hex editor. The question is what you would do with it, you do need to uncompress it to get the original data back.

The simplest way to access the data is to let uncompress a file or all of it with a program that is designed to do that, It is not a required way, you can mount the file as a file system program that can access directly. Then the decompression is done on the fly.

Here is how you can do it in Linux https://unix.stackexchange.com/questions/168807/mount-zip-file-as-a-read-only-filesystem there is a program that can do it in windows https://www.winarchiver.com/tutorials/how-to-mount-zip-file.htm there are likely other.

You can’t just do that without mounting it as a file system in general because the operating system has not to be coded to include that functionality. It could have been done but it has not been done. The data will still be uncompressed but it will be done when you request the data. Because of how zip files work writing back will be more complicated and slower, the Linux example mounted they read-only.

Anonymous 0 Comments

It doesn’t have to. If the program understands .zip format, it can read the information directly. For example, .docx files (that Microsoft Word produces) are actually .zip files. Microsoft Word can read them without unzipping.

However, most programs do not understand .zip format. So you have to first unzip the files with a program that does.

Anonymous 0 Comments

A zip file doesn’t really contain the information, it contains instructions on how to recreate the information. The process of reconstructing the file is what unzipping is. Eg, a compressed book isn’t actually the book, it’s a list of all the words in the book plus the positions each of those words is in, because storing the locations of a word that repeats often takes up less space than storing a copy of that word each time.

Anonymous 0 Comments

If you look at the technical side of this there is no reason. An application that is written to work with zip files can read the file structure, uncompress each file into memory to work with the data, and even stream the uncompressed file. The only technical limitation is that you can not read any data in the middle of an archived file because the compression algorithm adapts as it is compressing the file so the begining of the file will change how the end is being compressed.

However in order to handle zip files natively you need to rewrite part of your application to use the interfaces provided by the zip libraries instead of using the interfaces provided by the file system. So it adds complexity to the application. So the easiest way to get any application to read the content of your compressed files is to first uncompress them onto the disk.

Anonymous 0 Comments

Many file compression methods can be read while still compressed, just far less efficiently.

Think about writing somthing realy small to save space on the paper, you could read it word by word with a magnifying glass its inefficient but it works. However if your going to need to reference it often then it’s going to be better to transcribe a larger version to another piece of paper.

Another way to save space would be to remove all the spaces and replace commonly used groups of letters such as “ing” with a single symbol representing all 3 letters. With this method you’ve also greatly reduced the space needed to write somthing but it’s going to take you a while to decipher it when you need to read it one day. This represents a file that needs to be decompressed to access

Anonymous 0 Comments

imagine deflating your floatie to pack it up to travel

you need to inflate it to be able to use it, even if you have everything a floatie has

Anonymous 0 Comments

Imagine your file is a lego model of a an X-Wing. if you break the model down into individual bricks and make them into a solid cube it takes up less space. You have the instructions so you can rebuild it at will. This is like the compressed file. All the information and parts are there to rebuild your X-Wing but you have to build the whole thing or none of it; you can’t just get, say, the X-Wing engines without starting from Step 1 and making the whole of it first.

So you can make it appear you’re accessing it at will but actually you’re decopressing and them compressing it again very fast.