FileExt.Write Method (Byte[], String, CancellationToken)

Asynchronously writes an Array of Byte to a file at path.

Namespace: UltimateXR.Extensions.System.IO
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0

Syntax

C#

public static Task Write(
	byte[] bytes,
	string path,
	CancellationToken ct = default
)


Parameters

 

bytes
Type: System.Byte[]
File content as Array of Byte
path
Type: System.String
File full path to be opened for writing
ct (Optional)
Type: System.Threading.CancellationToken
Optional cancellation token, to cancel the asynchronous operation

Return Value

Type: Task
An awaitable writing Task

Exceptions

ExceptionCondition
IOExceptionAn I/O error occurred while creating the file.
ArgumentExceptionpath is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the GetInvalidPathChars() method.
PathTooLongExceptionThe path parameter is longer than the system-defined maximum length.
UnauthorizedAccessExceptionThe caller does not have the required permission.
OperationCanceledExceptionTask canceled using ct

See Also

Reference

FileExt Class
Write Overload
UltimateXR.Extensions.System.IO Namespace