VFile.ReadAllBytesAsync Method
Namespace: Rebex.IO
Assembly: Rebex.FileSystem.dll (version 7.0.9119)
ReadAllBytesAsync(String, CancellationToken)
Method returns a byte array that contains the binary content of a file identified by the path
.
Declaration
public static Task<byte[]> ReadAllBytesAsync(string path, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the file. |
CancellationToken | cancellationToken | The cancellation token. See remarks for details. |
Returns
Type | Description |
---|---|
Task<Byte[]> | A Task<TResult>, which wraps the byte array that contains the binary content of a file identified by the |
Remarks
Rebex virtual file systems are synchronous. This method is provided only for compatibility with the File API on modern platforms.
Despite the async suffix this method runs synchronously and returns byte array wrapped in the instance of the Task<byte[]> class.
The cancellationToken
is not used.
If the need to offload the operation to the background thread arise,
consider using the .NET Task.Run (or TaskFactory.StartNew on older platforms) API
with the synchronous Rebex.IO.FileSystem.IO.VFile.ReadAllBytes(System.String) method.