Edit

Share via


ZipArchiveEntry.OpenAsync(CancellationToken) Method

Definition

Asynchronously opens the entry.

public System.Threading.Tasks.Task<System.IO.Stream> OpenAsync(System.Threading.CancellationToken cancellationToken = default);
member this.OpenAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.IO.Stream>
Public Function OpenAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of Stream)

Parameters

cancellationToken
CancellationToken

The token to monitor for cancellation requests.

Returns

A Stream that represents the contents of the entry.

Exceptions

The entry is already currently open for writing.

-or-

The entry has been deleted from the archive.

-or-

The archive that this entry belongs to was opened in ZipArchiveMode.Create mode, and this entry has already been written to once.

The entry is missing from the archive or is corrupt and cannot be read.

-or-

The entry has been compressed using a compression method that isn't supported.

The ZipArchive that this entry belongs to has been disposed.

Remarks

If the archive that the entry belongs to was opened in Read mode, the returned stream will be readable, and it might or might not be seekable. If opened in Create mode, the returned stream will be writable and not seekable. If opened in Update mode, the returned stream will be readable, writable, and seekable, and support SetLength.

Applies to