archive.tar

Functions and types that implement the TarPolicy used with the Archive template.

Members

Aliases

TarArchive
alias TarArchive = Archive!(TarPolicy)

Convenience alias that simplifies the interface for users

Classes

TarException
class TarException

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

TarPolicy
class TarPolicy

Policy class for reading and writing tar archives. Features: + Handles files and directories of arbitrary size + Files and directories may have permissions + Files and directories may optionally set an owner and group name/id. Limitations: + File paths may not exceed 255 characters - this is due to the format specification.

Enums

TarTypeFlag
enum TarTypeFlag

Enum class for types supported by tar files. Directory is given special treatment, all others have any content placed in the data field.

Structs

TarPermissions
struct TarPermissions

Helper struct for unix permissions

Meta

Source

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

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

Reading Usage:

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

Writing Usage:

1 import archive.tar;
2 
3 auto archive = new TarArchive();
4 
5 auto file = new TarArchive.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.tar", cast(ubyte[])archive.serialize());

Authors

Richard W Laughlin Jr.