ZipFile.OpenReadAsync(String, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Asynchronously opens a ZipArchive on the specified path for reading. The specified file is opened with FileMode.Open.
public static System.Threading.Tasks.Task<System.IO.Compression.ZipArchive> OpenReadAsync(string archiveFileName, System.Threading.CancellationToken cancellationToken = default);
static member OpenReadAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.IO.Compression.ZipArchive>
Public Shared Function OpenReadAsync (archiveFileName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ZipArchive)
Parameters
- archiveFileName
- String
A string specifying the path on the filesystem to open the archive on. The path is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory.
- cancellationToken
- CancellationToken
The cancellation token to monitor for cancellation requests.
Returns
Exceptions
archiveFileName is a zero-length string, contains only whitespace, or contains one or more invalid characters as defined by InvalidPathChars.
archiveFileName is null.
The specified archiveFileName exceeds the system-defined maximum length.
For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
The specified archiveFileName is invalid, (for example, it is on an unmapped drive).
An unspecified I/O error occurred while opening the file.
archiveFileName specified a directory.
-or-
The caller does not have the required permission.
The file specified in archiveFileName was not found.
archiveFileName is in an invalid format.
The specified file could not be interpreted as a zip file.
An asynchronous operation is cancelled.