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:

import archive.tar;
import std.stdio;

auto archive = new TarArchive(std.file.read("my.tar");

foreach(file; archive.files)
{
    writeln("Filename: ", file.path);
    writeln("Data: ", file.data);
}

Writing Usage:

import archive.tar;

auto archive = new TarArchive();

auto file = new TarArchive.File("languages/awesome.txt");
file.data = "D\n"; // can also set to immutable(ubyte)[]
archive.addFile(file);

std.file.write("lang.tar", cast(ubyte[])archive.serialize());

Authors

Richard W Laughlin Jr.