Zip, tar: is there a file table

0

1

Is there a file table, or inode structure (like in filesystems) of a zip or tar file?

agz

Posted 2013-01-19T21:19:39.220

Reputation: 6 820

Answers

2

No. Both tar and zip formats are designed so you can add files onto the end. Individual files or directories are added as contiguous header + data segments. There is no filesystem that allocates blocks to files in a non-contiguous fashion.

Tar files have no directory mechanism. Each tar header tells the file name, mode bits, userid and groupid, timestamp and filesize of the data segment that follows. End of the tar archive is marked by a null header. The way to know what's in a tar file is to read it, though if it's on disk, you can jump from one header to the next by seeking over the data segments.

Zip files follow the same conceptual format of repeated header + data segments but add a directory onto the end.

Zip format

Nicole Hamilton

Posted 2013-01-19T21:19:39.220

Reputation: 8 987

So to clarify, the header's info on the filesize dictates where the file ends and the next begins? And the central directory just dictates the offset on where the file begins? – agz – 2013-01-20T05:14:27.643

1@agovizer The directory at the end is largely redundant of the information in the individual headers. The reason for it is to avoid having to scan the entire archive to find out what's in it, as has to be done with a tar file. – Nicole Hamilton – 2013-01-20T16:25:55.160