3.5 Zip archive basics

When using zip.hwp's low-level interface, you first have to learn some basics about the structure of zip archives.

Zip archives are just a collection of files that are stored at indices ranging from 0 to the number of entries in the zip archive minus 1. It is not necessary to store directories as individual entries. Instead, they can also be stored as part of a filename, e.g. if a file is stored as a/b/c/test.txt in the zip archive, then the directories a, b, and c are implicitly declared as existing even though they don't have their individual entries in the zip archive but just exist as part of a file.

Of course, directories can also be stored as individual entries instead of as part of a filename. In that case, they are simply stored as files with a size of 0 bytes with the filename ending in a slash signalling that the entry is a directory. Since there is no distinct directory entry type in zip archives, all functions in this plugin dealing with files can also operate on directories within the zip archive. So don't be confused that a function like zip.RenameFile() can also be used to rename directories and zip.DeleteFile() can also delete directories. Inside a zip archive, directories and files are really pretty much the same except that for directories their filename ends in a slash to signal that it is not a file.


Show TOC