ArchiveReader
OfficeIMO.Archives
Reads selected archive content without filesystem publication or executing its contents.
Inheritance
- object
- ArchiveReader
Methods
public static IReadOnlyList<ArchiveEntryDescriptor> EnumerateZip(string zipPath, ArchiveTraversalOptions? options = null) #Enumerates ZIP entries from a path.
Parameters
- zipPath string
- options OfficeIMO.Archives.ArchiveTraversalOptions? = null
Returns
IReadOnlyList<ArchiveEntryDescriptor>public static IReadOnlyList<ArchiveEntryDescriptor> EnumerateZip(Stream zipStream, ArchiveTraversalOptions? options = null) #Enumerates ZIP entries from a stream.
Parameters
- zipStream System.IO.Stream
- options OfficeIMO.Archives.ArchiveTraversalOptions? = null
Returns
IReadOnlyList<ArchiveEntryDescriptor>public static Rar5ArchiveInfo InspectRar5(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads the authoritative file table and verifies the archive comment when stored. The source remains open.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Rar5ArchiveInfopublic static Rar5ArchiveInfo InspectRar5Volumes(IReadOnlyList<Stream> volumes, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads the file table and optional comment of a complete RAR5 set supplied in volume order. Each stream is read from its current position to EOF and left open.
Parameters
- volumes System.Collections.Generic.IReadOnlyList<System.IO.Stream>
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
Rar5ArchiveInfopublic static IReadOnlyList<Rar5ArchiveEntry> ListRar5(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Lists the authoritative file headers of a RAR5 archive in file order. The source remains open.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<Rar5ArchiveEntry>public static IReadOnlyList<SevenZipArchiveEntry> ListSevenZip(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Lists the validated file table of a 7z archive. Encoded metadata may be decompressed, but file payloads are not decoded. The source is read from its current position and left open.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<SevenZipArchiveEntry>Exceptions
NotSupportedException– The archive uses encryption or an unsupported structure.
public static IReadOnlyList<TarArchiveEntry> ListTar(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Lists every member of a plain or compressed TAR, including directories, symbolic and hard links with their authored targets, and device records, without reading file content or validating names as output paths. Reads from the stream's current position to EOF and leaves the stream open.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<TarArchiveEntry>Exceptions
OfficeInspectionResourceLimitException– A configured or managed admission ceiling is exhausted.InvalidDataException– The archive is corrupt or truncated.ArchiveCorruptionException– The Zstandard, xz or lzip wrapper is corrupt or truncated.NotSupportedException– The input is not TAR, or uses sparse or multi-volume members.
public static IReadOnlyList<ArchiveEntryData> ReadRar5(byte[] data, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Returns selected stored RAR5 files in primary header order after verifying their checksums. The caller must keep source bytes unchanged for the duration of the read.
Parameters
- data byte[]
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>public static IReadOnlyList<ArchiveEntryData> ReadRar5(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads and verifies selected stored RAR5 entries from the stream's current position to EOF, leaving it open.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>public static IReadOnlyList<ArchiveEntryData> ReadRar5Volumes(IReadOnlyList<Stream> volumes, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Returns the verified stored files of a complete RAR5 set supplied in volume order. Each stream is read from its current position to EOF and left open.
Parameters
- volumes System.Collections.Generic.IReadOnlyList<System.IO.Stream>
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>public static IReadOnlyList<ArchiveEntryData> ReadSevenZip(byte[] data, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads selected regular files from 7z bytes, verifying the complete containing solid folders before returning. The caller must leave the input bytes unchanged for the duration of the call.
Parameters
- data byte[]
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>public static IReadOnlyList<ArchiveEntryData> ReadSevenZip(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads selected regular files of a 7z archive from the stream's current position, leaving it open. Entire selected solid folders are verified, even when only one member is requested.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>public static IReadOnlyList<ArchiveEntryData> ReadTar(byte[] bytes, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads the selected regular files of a TAR, plain or compressed with gzip, Zstandard, xz or lzip (.tar.gz, .tar.zst, .tar.xz, .tar.lz), from bytes, with the same path safety, collision and limit checks as extraction. Links, devices and directories are not returned; use ArchiveReader.ListTar for their metadata.
Parameters
- bytes byte[]
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>Exceptions
OfficeInspectionResourceLimitException– A configured or managed admission ceiling is exhausted.InvalidDataException– The archive is corrupt, truncated or unsafe.ArchiveCorruptionException– The Zstandard, xz or lzip wrapper is corrupt or truncated.NotSupportedException– The input is not TAR, or uses sparse or multi-volume members.
public static IReadOnlyList<ArchiveEntryData> ReadTar(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads the selected regular files of a plain or compressed TAR from the stream's current position to EOF. Supports nonseekable streams, leaves the caller's stream open and advances it by the bytes read.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>Exceptions
OfficeInspectionResourceLimitException– A configured or managed admission ceiling is exhausted.InvalidDataException– The archive is corrupt, truncated or unsafe.ArchiveCorruptionException– The Zstandard, xz or lzip wrapper is corrupt or truncated.NotSupportedException– The input is not TAR, or uses sparse or multi-volume members.
public static IReadOnlyList<ArchiveEntryData> ReadZip(byte[] bytes, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads a ZIP from bytes using the same strict member validation as extraction. Returns only after every selected payload is fully verified. Do not modify the input during this call.
Parameters
- bytes byte[]
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>Exceptions
OfficeInspectionResourceLimitException– A configured or managed admission ceiling is exhausted.
public static IReadOnlyList<ArchiveEntryData> ReadZip(Stream source, ArchiveReadOptions? options = null, CancellationToken cancellationToken = default) #Reads from the stream's current position to EOF into a bounded snapshot. Supports nonseekable streams, leaves the caller's stream open, and advances its position by the bytes read. Selected content is independent of the stream after return.
Parameters
- source System.IO.Stream
- options OfficeIMO.Archives.ArchiveReadOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
IReadOnlyList<ArchiveEntryData>Exceptions
OfficeInspectionResourceLimitException– A configured or managed admission ceiling is exhausted.
public static ArchiveTraversalResult TraverseZip(string zipPath, ArchiveTraversalOptions? options = null) #Traverses ZIP entries from a path and returns accepted entries with warnings.
Parameters
- zipPath string
- options OfficeIMO.Archives.ArchiveTraversalOptions? = null
Returns
ArchiveTraversalResultpublic static ArchiveTraversalResult TraverseZip(Stream zipStream, ArchiveTraversalOptions? options = null) #Traverses ZIP entries from a stream and returns accepted entries with warnings.
Parameters
- zipStream System.IO.Stream
- options OfficeIMO.Archives.ArchiveTraversalOptions? = null
Returns
ArchiveTraversalResultpublic static ArchiveTraversalResult TraverseZip(Stream zipStream, ArchiveTraversalOptions? options, CancellationToken cancellationToken) #Traverses a ZIP source with a physical-entry preflight and cooperative cancellation.
Parameters
- zipStream System.IO.Stream
- options OfficeIMO.Archives.ArchiveTraversalOptions?
- cancellationToken System.Threading.CancellationToken
Returns
ArchiveTraversalResultpublic static ArchiveTraversalResult TraverseZip(ZipArchive archive, ArchiveTraversalOptions? options = null) #Traverses ZIP entries from an already opened archive and returns accepted entries with warnings. Names are already decoded by its owner; raw filename encoding cannot be validated or changed by this overload.
Parameters
- archive System.IO.Compression.ZipArchive
- options OfficeIMO.Archives.ArchiveTraversalOptions? = null
Returns
ArchiveTraversalResultpublic static ArchiveTraversalResult TraverseZip(ZipArchive archive, ArchiveTraversalOptions? options, CancellationToken cancellationToken) #Traverses an opened archive with bounded metadata processing and cooperative cancellation. Names retain the decoding policy applied when the archive was opened.
Parameters
- archive System.IO.Compression.ZipArchive
- options OfficeIMO.Archives.ArchiveTraversalOptions?
- cancellationToken System.Threading.CancellationToken
Returns
ArchiveTraversalResultpublic static ArchiveTraversalResult TraverseZip(ArchiveInspection inspection, ArchiveTraversalOptions? options = null, CancellationToken cancellationToken = default) #Applies ZIP ingestion selection policy to an existing immutable inspection without reparsing its input. Metadata acceptance does not verify member content; use inspection.OpenRead or ReadMembers for payloads.
Parameters
- inspection OfficeIMO.Archives.ArchiveInspection
- options OfficeIMO.Archives.ArchiveTraversalOptions? = null
- cancellationToken System.Threading.CancellationToken = default
Returns
ArchiveTraversalResultpublic static void ValidateZipSource(Stream zipStream, ArchiveTraversalOptions? options = null, CancellationToken cancellationToken = default) #Validates compressed size and physical entry count on a seekable ZIP source before opening a ZipArchive. The source position is restored. This check is safe only if the caller keeps the source bytes immutable until its archive has been read. Prefer a stream or path TraverseZip overload for mutable or untrusted sources.
Parameters
- zipStream System.IO.Stream
- options OfficeIMO.Archives.ArchiveTraversalOptions? = null
- cancellationToken System.Threading.CancellationToken = default