archive.zip
$(DDOC_SECTIONS Functions and Types that implement the Zip Policy used with the Archive template.
License:
.
Authors:
Refactored into Policy by Richard W Laughlin Jr.
Original zip code by
Source:
http:
//github.com/rcythr/archive
Policy for the Archive template which provides reading and writing of Zip files.
Reading Usage:
import archive.zip;
import std.stdio;
auto archive = new ZipArchive(std.file.read("my.zip");
foreach(file; archive.files)
{
writeln("Filename: ", file.path);
writeln("Data: ", file.data);
}
)
Writing Usage:
import archive.zip;
auto archive = new ZipArchive();
auto file = new ZipArchive.File("languages/awesome.txt");
file.data = "D\n"; // can also set to immutable(ubyte)[]
archive.addFile(file);
std.file.write("lang.zip", cast(ubyte[])archive.serialize());
- class ZipException: object.Exception;
- Thrown when a zip file is not readable or contains errors.
- enum CompressionMethod: ushort;
- Specifies the compression for a particular zip entry.
- class ZipPolicy;
- Policy class for reading and writing zip archives.
Currently lacks support for:
+ Multiple disk zip files
+ Compression algorithms other than deflate
+ Zip64
+ Encryption
- class DirectoryImpl: archive.core.ArchiveDirectory!(ZipPolicy).ArchiveDirectory;
- Directory implementation for Zip archives. Provides any additional functionality required by ZipArchives.
- class FileImpl: archive.core.ArchiveMember;
- File implementation for Zip archives. Provides any additional functionality required of files by ZipArchives.
- @property immutable(ubyte)[] data();
- Returns:
the decompressed data.
- @property void data(immutable(ubyte)[] data);
@property void data(string newdata);
- Sets the decompressed data.
- @property immutable(ubyte)[] compressed();
- Returns:
the compressed data
- @property CompressionMethod compressionMethod();
- Returns:
the compression method.
- @property void compressionMethod(CompressionMethod method);
- Sets the compression method that will be used.
- ubyte[] extra;
- Additional data stored within the zip archive for this file.
- string comment;
- The comment for the member of the archive.
- DosFileTime modificationTime;
- The time when the file was last modified.
- ushort flags;
- Zip related flags specific for this member, as specified by the Zip format documentation.
- ushort internalAttributes;
- The internal attributes specific to this member, as specified by the Zip format documentation.
- uint externalAttributes;
- The internal attributes specific to this member, as specified by the Zip format documentation.
- class Properties;
- Archive-wide properties for ZipArchives.
- string comment;
- Archive-wide File comment stored in the archive.
- void deserialize(Filter)(void[] data, Archive!(ZipPolicy, Filter) archive);
- Deserialize method which loads data from a zip archive and stores it in archive.
- void[] serialize(Filter)(Archive!(ZipPolicy, Filter) archive);
- Serialize method which writes data stored in the archive to an array and returns it.
- alias ZipArchive = archive.core.Archive!(ZipPolicy, NullArchiveFilter).Archive;
- Convenience alias that simplifies the interface for users
Page generated by Ddoc. Copyright Richard W Laughlin Jr. 2014—2016