![]() With zip archives, there is always the need to have the entire file at hand to do anything useful with it, whereas a tar archive can be streamed to a pipeline. This may sound like a trivial difference, but in fact represents a polar opposite in philosophy. In the worst case, you'd need slightly more blocks until you can start extracting. ![]() Compression is applied on top of that each of the various compression programs that are applied to tar archives ( compress, gzip, bzip2 etc.) are stream compressors and don't alter the sequential nature of the archive in any matter. Tar archives are intended to be read in one fell swoop if only a single file is to be extracted, the archive is read sequentially, starting from the very beginning until the requested file is found (which may as well be at the very end). There is no central directory instead, the archive contains header blocks at regular intervals which indicate which files will follow in the next few blocks. Tar archives were devised for bundling backups to be used for tape drives, hence for sequential access. Much like most web sites bundle their downloads even today, for the same reasons. Zip archives were created for BBS use, where it was important to be able to bundle the contents of a directory into one single (and compressed) file-instead of having to download possibly thousands of single files. In addition, the archive directory is vulnerable: If the archive gets truncated for some reason, it requires heavy wizardry to extract anything useful from the archive. However, this requires that the whole archive is accessible, and requires random access which is only available on block devices (floppy disks, hard drives). This allows to quickly extract single files without having to unpack the whole archive: Just read the archive directory and extract only what is needed. Zip archives contain a central directory of their contents at the end (most likely to avoid having to create the directory beforehand, where you don't yet know what will be inside).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |