FileExt.Write Method (String, Stream, CancellationToken)
Asynchronously writes the content of an sourceStream 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(
string path,
Stream sourceStream,
CancellationToken ct = default
)
Parameters
- path
- Type: System.String
File full path to be opened for writing - sourceStream
- Type: System.IO.Stream
Stream to be written into a file. - 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. |
NotSupportedException | sourceStream does not support reading, or the destination stream does not support writing. |
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