Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​IO.​Compression.​ZipArchive
Assembly: System.IO.Compression
Inheritance: object → ZipArchive
Implemented Interfaces
Represents a package of compressed files in the zip archive format.
Properties
public
string
Comment
Gets or sets the optional archive comment.
public
Collections.​ObjectModel.​ReadOnlyCollection<​ZipArchiveEntry>
Entries
Gets the collection of entries that are currently in the zip archive.
public
ZipArchiveMode
Mode
Gets a value that describes the type of action the zip archive can perform on entries.
Methods
public static
Threading.​Tasks.​Task<​ZipArchive>
CreateAsync​(Stream stream,
ZipArchiveMode mode,
bool leaveOpen,
Text.​Encoding? entryNameEncoding,
Threading.​CancellationToken cancellationToken = null)
Asynchronously initializes and returns a new instance of <see cref="T:System.IO.Compression.ZipArchive" /> on the given stream in the specified mode, specifying whether to leave the stream open, with an optional encoding and an optional cancellation token.
stream
The input or output stream.
mode
One of the enumeration values that specifies whether the stream supports reading, writing, and seeking.
leaveOpen
<see langword="true" /> to leave the stream open upon disposing the ZipArchive, otherwise <see langword="false" /> .
entryNameEncoding
The encoding to use when reading or writing entry names and comments in this ZipArchive.
cancellationToken
The optional cancellation token to monitor.
public
ZipArchiveEntry
CreateEntry​(string entryName)
Creates an empty entry that has the specified path and entry name in the zip archive.
Returns An empty entry in the zip archive.
entryName
A path, relative to the root of the archive, that specifies the name of the entry to be created.
public
ZipArchiveEntry
CreateEntry​(string entryName,
CompressionLevel compressionLevel)
Creates an empty entry that has the specified entry name and compression level in the zip archive.
Returns An empty entry in the zip archive.
entryName
A path, relative to the root of the archive, that specifies the name of the entry to be created.
compressionLevel
One of the enumeration values that indicates whether to emphasize speed or compression effectiveness when creating the entry.
public
void
Dispose​()
Releases the resources used by the current instance of the <see cref="T:System.IO.Compression.ZipArchive" /> class.
protected
void
Dispose​(bool disposing)
Called by the <see cref="M:System.IO.Compression.ZipArchive.Dispose" /> and <see cref="M:System.Object.Finalize" /> methods to release the unmanaged resources used by the current instance of the <see cref="T:System.IO.Compression.ZipArchive" /> class, and optionally finishes writing the archive and releases the managed resources.
disposing
<see langword="true" /> to finish writing the archive and release unmanaged and managed resources; <see langword="false" /> to release only unmanaged resources.
DisposeAsyncCore​()
public
ZipArchiveEntry
GetEntry​(string entryName)
Retrieves a wrapper for the specified entry in the zip archive.
Returns A wrapper for the specified entry in the archive; <see langword="null" /> if the entry does not exist in the archive.
entryName
A path, relative to the root of the archive, that identifies the entry to retrieve.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object