ddn.archive.tar

ddn.archive.tar

TAR archive reader and writer implementing ddn.api.archive.

Supports reading and writing POSIX TAR archives in ustar, pax, and GNU formats. Implements the streaming ArchiveReader and ArchiveWriter interfaces.

Provider name convention: vendor "ddn", toString() returns "ddn-tar".

Module Initializers 1

shared static this()

Types 2

TAR archive reader implementing ArchiveReader.

Reads from an in-memory byte slice. Supports ustar, GNU, and basic V7 formats.

Methods
ArchiveFormat format() @property const
size_t entryCount() @property const
string comment() @property const
bool nextEntry(out EntryInfo info)
bool contains(string path)
EntryInfo getEntry(string path)
void readContent(const EntryInfo entry, ContentSink sink)
void extractTo(ref const EntryInfo entry, string destPath)
void extractAll(string destDir)
void close()
bool isClosed() @property const
Constructors
this(const(ubyte)[] data, ReadOptions opts)Create a TAR reader from archive data.

TAR archive writer implementing ArchiveWriter.

Produces a ustar-format TAR archive stream via a ContentSink.

Methods
ArchiveFormat format() @property const
void addDirectory(string path, FilePermissions perms = FilePermissions.fromOctal(octal!"755"))
void addFile(string path, const(ubyte)[] content, EntryWriteOptions opts = EntryWriteOptions.init)
void addFile(string path, scope const(ubyte)[] delegate() source, ulong size = 0, EntryWriteOptions opts = EntryWriteOptions.init)
void addFileFrom(string archivePath, string filesystemPath, EntryWriteOptions opts = EntryWriteOptions.init)
void addSymlink(string path, string target)
void addHardlink(string path, string target)
void addEntry(ref const EntryInfo info, scope const(ubyte)[] delegate() source)
void setComment(string comment)
void removeEntry(string path)
void updateEntry(string path, const(ubyte)[] content, EntryWriteOptions opts = EntryWriteOptions.init)
void finish()
void close()
bool isFinished() @property const
bool isClosed() @property const
ulong bytesWritten() @property const
size_t entriesWritten() @property const
Constructors
this(ContentSink sink, WriteOptions opts)Create a TAR writer.

Functions 3

fnArchiveReader makeTarReader(const(ubyte)[] data, ReadOptions opts)Factory function that constructs a TarReader.
fnArchiveWriter makeTarWriter(ContentSink sink, WriteOptions opts)Factory function that constructs a TarWriter.
fnArchiveFormat detectTarFormat(const(ubyte)[] header)Detect TAR format from header bytes.