TarEntry.ExtractToFileAsync(String, Boolean, 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 extracts the current entry to the filesystem.
public System.Threading.Tasks.Task ExtractToFileAsync (string destinationFileName, bool overwrite, System.Threading.CancellationToken cancellationToken = default);
member this.ExtractToFileAsync : string * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function ExtractToFileAsync (destinationFileName As String, overwrite As Boolean, Optional cancellationToken As CancellationToken = Nothing) As Task
Parameters
- destinationFileName
- String
The path to the destination file.
- overwrite
- Boolean
true
if this method should overwrite any existing filesystem object located in the destinationFileName
path; false
to prevent overwriting.
- cancellationToken
- CancellationToken
The token to monitor for cancellation requests. The default value is None.
Returns
A task that represents the asynchronous extraction operation.
Exceptions
destinationFileName
is null
.
destinationFileName
is empty.
The parent directory of destinationFileName
does not exist.
-or-
overwrite
is false
and a file already exists in destinationFileName
.
-or-
A directory exists with the same name as destinationFileName
.
-or-
An I/O problem occurred.
The entry type is unsupported.
Permissions are insufficient.
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
Files of type BlockDevice, CharacterDevice, or Fifo can only be extracted in Unix platforms.
Elevation is required to extract a BlockDevice or CharacterDevice to disk.
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by ExtractToFile(String, Boolean).