Create sample ZIP files
Result
Via git archive, zero compression:
dir1.via-git-c0.zipdir64-bigfile.via-git-c0.zipdir64-bigtotal.via-git-c0.zipdir64-many.via-git-c0.zipdir64-all.via-git-c0.zip
Sample dir (dir1/)
dir1/
README.md
src/
foo.py
mkdir dir1
cd dir1
echo 'Welcome!' > README.md
mkdir src
echo "print(2 + 3)" > src/foo.py
git init
git add .
git commit -m -
Creating .zip files via git archive
cd dir1
git archive --format=zip -0 HEAD > ../dir1.via-git-c0.zip
Some details about the .zip file that this creates:
- PK34/PK12 pairs are created for items named
README.md,src/, andsrc/foo.py - Both the PK34s and the PK12s include the
UTextra field to provide one-second-resolution UTC timestamps - These item timestamps match the commit's timestamp, not the timestamp at which
git archivewas run - The last 40 bytes of the file are the ASCII hex characters of the commit ID (via the "comment" field of the PK56 record)
- zip64 records are not used in this file
Zip64 records would be used if the files in the archive were large enough and/or numerous enough to require zip64. See Zip64 examples.
Creating .zip files via zip
This is the Info-ZIP implementation, bundled with most platforms as zip.
TODO
Creating .zip files via ditto
This is macOS's implememtation for the File → Compress action.
TODO
TODO: example with resource forks and various metadata
Creating .usdz files via usdzip
TODO
Details:
- USDZ files require 64-byte alignment for the offset of the start of each file's content. This is implemented via padding in the PK34's "extra" field when needed.
Zip64 examples
dir64-bigfile/
README.md
files/
bigfile 5GB
dir64-bigtotal/
README.md
files/
mediumfile1 3GB
mediumfile2 3GB
dir64-many/
README.md
files/
text00000.txt "file 00000\n"
...
text70000.txt "file 70000\n"
dir64-all/
...the union of all of the above filesets...
...TODO: creating these...
cd dir64-bigfile && git archive --format=zip -0 HEAD > ../dir64-bigfile.via-git-c0.zip
cd ../dir64-bigtotal && git archive --format=zip -0 HEAD > ../dir64-bigtotal.via-git-c0.zip
cd ../dir64-many && git archive --format=zip -0 HEAD > ../dir64-many.via-git-c0.zip
cd ../dir64-all && git archive --format=zip -0 HEAD > ../dir64-all.via-git-c0.zip