archive.zip

Functions and Types that implement the Zip Policy used with the Archive template.

Members

Aliases

ZipArchive
alias ZipArchive = Archive!ZipPolicy

Convenience alias that simplifies the interface for users

Classes

ZipException
class ZipException

Thrown when a zip file is not readable or contains errors.

ZipPolicy
class ZipPolicy

Policy class for reading and writing zip archives.

Enums

CompressionMethod
enum CompressionMethod

Specifies the compression for a particular zip entry.

Meta

Source

See Source File
http://github.com/rcythr/archive

Policy for the Archive template which provides reading and writing of Zip files.

Reading Usage:

1 import archive.zip;
2 import std.stdio;
3 
4 auto archive = new ZipArchive(std.file.read("my.zip");
5 
6 foreach(file; archive.files)
7 {
8     writeln("Filename: ", file.path);
9     writeln("Data: ", file.data);
10 }

Writing Usage:

1 import archive.zip;
2 
3 auto archive = new ZipArchive();
4 
5 auto file = new ZipArchive.File("languages/awesome.txt");
6 file.data = "D\n"; // can also set to immutable(ubyte)[]
7 archive.addFile(file);
8 
9 std.file.write("lang.zip", cast(ubyte[])archive.serialize());

Authors

Refactored into Policy by Richard W Laughlin Jr. Original zip code by Walter Bright