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
Exception | Condition |
---|---|
IOException | An I/O error occurred while creating the file. |
ArgumentException | path 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. |
PathTooLongException | The path parameter is longer than the system-defined maximum length. |
UnauthorizedAccessException | The caller does not have the required permission. |
OperationCanceledException | Task canceled using ct |
See Also
Reference
FileExt Class
Write Overload
UltimateXR.Extensions.System.IO Namespace