Partager via


IFileSystemProvider.WriteFileAsync Method

Definition

Writes data to a file, replacing its entire contents if the file already exists.

public:
 System::Threading::Tasks::Task ^ WriteFileAsync(Uri ^ uri, System::IO::Pipelines::PipeReader ^ reader, bool overwrite, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task WriteFileAsync (Uri uri, System.IO.Pipelines.PipeReader reader, bool overwrite, System.Threading.CancellationToken cancellationToken);
abstract member WriteFileAsync : Uri * System.IO.Pipelines.PipeReader * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WriteFileAsync (uri As Uri, reader As PipeReader, overwrite As Boolean, cancellationToken As CancellationToken) As Task

Parameters

uri
Uri

The file to write.

reader
PipeReader

The reader for the pipe containing the data to be written to the file.

overwrite
Boolean

Indicates whether an existing file can be overwritten.

cancellationToken
CancellationToken

The cancellation token.

Returns

A task representing the asynchronous write operation.

Exceptions

uri or reader is null.

The parent of uri doesn't exist.

uri exists and overwrite is false. ErrorCode will be set to FileAlreadyExists.

The caller does not have the required permission.

Applies to