openArchive
ArchiveReader 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
path | Path to the archive file. |
opts | Read options including format and password. |
Returns
Throws
detected, or no provider is registered.
ArchiveReader 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
data | The archive data as a byte slice. |
opts | Read options including format and password. |
Returns
Throws
is registered for the format.
ArchiveReader 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
source | Source of raw archive bytes; consumed by the returned reader. |
opts | Read options including format and password. |
Returns
source.Throws
no provider is registered, or the provider does not support streaming.
ArchiveReader 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
source | Input range producing byte chunks. |
opts | Read options including format and password. |
Returns
Throws
is registered for the format.