openArchive

fnArchiveReader openArchive(string path, ReadOptions opts = ReadOptions.init)

Create a reader for an archive file.

Reads the entire file into memory, detects the format (if AUTO_DETECT), selects the best registered provider, and creates a reader instance.

Parameters

pathPath to the archive file.
optsRead options including format and password.

Returns

An ArchiveReader for the specified archive.

Throws

ArchiveError if the file cannot be read, format cannot be

detected, or no provider is registered.

fnArchiveReader openArchive(const(ubyte)[] data, ReadOptions opts = ReadOptions.init)

Create a reader from a byte slice.

Detects the format (if AUTO_DETECT), selects the best registered provider, and creates a reader instance.

Parameters

dataThe archive data as a byte slice.
optsRead options including format and password.

Returns

An ArchiveReader for the specified data.

Throws

ArchiveError if format cannot be detected or no provider

is registered for the format.

fnArchiveReader openArchive(ArchiveByteSource source, ReadOptions opts = ReadOptions.init)

Create a reader from a streaming byte source.

Buffers only a bounded header prefix for format detection, then hands the provider a source that replays the buffered bytes followed by the rest, so archives larger than memory can be read without slurping them first. The provider must implement ArchiveProvider.makeStreamingReader.

Parameters

sourceSource of raw archive bytes; consumed by the returned reader.
optsRead options including format and password.

Returns

An ArchiveReader consuming source.

Throws

ArchiveError if the source is null, the format cannot be detected,

no provider is registered, or the provider does not support streaming.

fnArchiveReader openArchive(Range)(Range source, ReadOptions opts = ReadOptions.init) if (isInputRange!Range && is(ElementType!Range : const(ubyte)[]))

Create a reader from an input range.

Reads all data from the range, then creates a reader.

Parameters

sourceInput range producing byte chunks.
optsRead options including format and password.

Returns

An ArchiveReader for the data from the range.

Throws

ArchiveError if format cannot be detected or no provider

is registered for the format.