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


Richard W Laughlin Jr.



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("my.tar");

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


Writing Usage:
import archive.tar;

auto archive = new TarArchive();

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

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

class TarException: object.Exception;
Thrown when a tar file is not readable or contains errors.

struct TarPermissions;
Helper struct for unix permissions

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

class TarPolicy;
Policy class for reading and writing tar archives.

+ 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.

+ File paths may not exceed 255 characters - this is due to the format specification.

class DirectoryImpl: archive.core.ArchiveDirectory!(TarPolicy).ArchiveDirectory;
Class for directories

class FileImpl: archive.core.ArchiveMember;
Class for files

void deserialize(Filter)(void[] data, Archive!(TarPolicy, Filter) archive);
Deserialize method which loads data from a tar archive.

void[] serialize(Filter)(Archive!(TarPolicy, Filter) archive);
Serialize method which writes data to a tar archive

alias TarArchive = archive.core.Archive!(TarPolicy, NullArchiveFilter).Archive;
Convenience alias that simplifies the interface for users

Page generated by Ddoc. Copyright Richard W Laughlin Jr. 2014—2016