在 ZIP 文件结构的上下文中,"disks" 是什么?
What are "disks" in this context of the structure of ZIP files?
我目前正在为自己开发一个迷你库来压缩和提取 ZIP 文件。到目前为止,我对 the documentation 没有任何重大问题,只是我不知道 ZIP 文件中的 "disks" 是什么以及如何计算磁盘数量:
4.3.16 End of central directory record:
end of central dir signature 4 bytes (0x06054b50)
number of this disk 2 bytes <= What does "disk" mean here?
number of the disk with the
start of the central directory 2 bytes <= What does "disk" mean here?
total number of entries in the
central directory on this disk 2 bytes <= What does "disk" mean here?
total number of entries in
the central directory 2 bytes
size of the central directory 4 bytes
offset of start of central
directory with respect to
the starting disk number 4 bytes <= What does "disk" mean here?
.ZIP file comment length 2 bytes
.ZIP file comment (variable size)
您提供的字词disk refers to floppy diskettes in the context of splitting and spanning ZIP files (see chapter 8.0 of the documentation;强调我的):
8.1.1 Spanning is the process of segmenting a ZIP file across
multiple removable media. This support has typically only
been provided for DOS formatted floppy diskettes.
现在,实现通常不再支持拆分和跨越(例如 here (see Limitations) or here(参见过程 finish_zip()
)),因为软盘甚至光盘已经过时了。如果你不支持拆分和跨越(一开始),你可以设置值如下:
number of this disk 2 bytes <= You only have one disk/file, so set it to 1.
number of the disk with the
start of the central directory 2 bytes <= You only have one disk/file, so set it to 1.
total number of entries in the
central directory on this disk 2 bytes <= Set it to the overall number of records.
offset of start of central
directory with respect to
the starting disk number 4 bytes <= Set this offset (in bytes) relative to
the start of your archive.
如果要支持拆分或跨越,则每次开始写入新 disk/file 时都必须增加磁盘数。为每个新 disk/file 重置 total number of entries in the central directory on this disk
。计算相对于文件开头的偏移量。
我目前正在为自己开发一个迷你库来压缩和提取 ZIP 文件。到目前为止,我对 the documentation 没有任何重大问题,只是我不知道 ZIP 文件中的 "disks" 是什么以及如何计算磁盘数量:
4.3.16 End of central directory record:
end of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes <= What does "disk" mean here? number of the disk with the start of the central directory 2 bytes <= What does "disk" mean here? total number of entries in the central directory on this disk 2 bytes <= What does "disk" mean here? total number of entries in the central directory 2 bytes size of the central directory 4 bytes offset of start of central directory with respect to the starting disk number 4 bytes <= What does "disk" mean here? .ZIP file comment length 2 bytes .ZIP file comment (variable size)
您提供的字词disk refers to floppy diskettes in the context of splitting and spanning ZIP files (see chapter 8.0 of the documentation;强调我的):
8.1.1 Spanning is the process of segmenting a ZIP file across multiple removable media. This support has typically only been provided for DOS formatted floppy diskettes.
现在,实现通常不再支持拆分和跨越(例如 here (see Limitations) or here(参见过程 finish_zip()
)),因为软盘甚至光盘已经过时了。如果你不支持拆分和跨越(一开始),你可以设置值如下:
number of this disk 2 bytes <= You only have one disk/file, so set it to 1.
number of the disk with the
start of the central directory 2 bytes <= You only have one disk/file, so set it to 1.
total number of entries in the
central directory on this disk 2 bytes <= Set it to the overall number of records.
offset of start of central
directory with respect to
the starting disk number 4 bytes <= Set this offset (in bytes) relative to
the start of your archive.
如果要支持拆分或跨越,则每次开始写入新 disk/file 时都必须增加磁盘数。为每个新 disk/file 重置 total number of entries in the central directory on this disk
。计算相对于文件开头的偏移量。