Object representing the entire archive. ZipArchives are collections of ArchiveMembers.
The archive comment. Must be less than 65536 bytes in length.
pure nothrow @nogc @property @safe ubyte[]
data();
Array representing the entire contents of the archive.
Returns:Data of the entire contents of the archive.
pure nothrow @nogc @property @safe uint
totalEntries() const;
Number of ArchiveMembers in the directory.
Returns:The number of files in this archive.
pure nothrow @nogc @property @safe bool
isZip64() const;
pure nothrow @nogc @property @safe void
isZip64(bool
value);
True when the archive is in Zip64 format. Set this to true to force building a Zip64 archive.
Parameters:boolvalue | True, when the archive is forced to be build in Zip64 format. |
Returns:True, when the archive is in Zip64 format.
pure nothrow @nogc @property @safe ArchiveMember[string]
directory();
Associative array indexed by the name of each member of the archive.
All the members of the archive can be accessed with a foreach loop:
Example
ZipArchive archive =new ZipArchive(data);foreach (ArchiveMember am; archive.directory){ writefln("member name is '%s'", am.name);}Returns:Associative array with all archive members.
pure nothrow @nogc @safe this();
Constructor to use when creating a new archive.
@safe void
addMember(ArchiveMember
de);
Add a member to the archive. The file is compressed on the fly.
Parameters:ArchiveMemberde | Member to be added. |
Throws:ZipException when an unsupported compression method is used or when compression failed.
@safe void
deleteMember(ArchiveMember
de);
Delete memberde from the archive. Uses the name of the member to detect which element to delete.
Parameters:ArchiveMemberde | Member to be deleted. |
pure @safe void[]
build();
Construct the entire contents of the current members of the archive.
Fills in the properties data[], totalEntries, and directory[]. For each ArchiveMember, fills in properties crc32, compressedSize, compressedData[].
Returns:Array representing the entire archive.
Throws:ZipException when the archive could not be build.
Constructor to use when reading an existing archive.
Fills in the properties data[], totalEntries, comment[], and directory[]. For each ArchiveMember, fills in properties madeVersion, extractVersion, flags, compressionMethod, time, crc32, compressedSize, expandedSize, compressedData[], internalAttributes, externalAttributes, name[], extra[], comment[]. Use expand() to get the expanded data for each ArchiveMember.
Parameters:void[]buffer | The entire contents of the archive. |
Throws:ZipException when the archive was invalid or when malware was detected.
ubyte[]
expand(ArchiveMember
de);
Decompress the contents of a member.
Fills in properties extractVersion, flags, compressionMethod, time, crc32, compressedSize, expandedSize, expandedData[], name[], extra[].
Parameters:ArchiveMemberde | Member to be decompressed. |
Returns:The expanded data.
Throws:ZipException when the entry is invalid or the compression method is not supported.