Class FileInfoExtensions
Extension methods for querying network file information and content.
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
public static class FileInfoExtensions
Methods
| Edit this page View SourceGetFileContentAsync(ConsensusClient, EntityId, CancellationToken, Action<IConsensusContext>?)
Retrieves the contents of a file from the network.
Declaration
public static Task<ReadOnlyMemory<byte>> GetFileContentAsync(this ConsensusClient client, EntityId file, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| EntityId | file | The address of the file contents to retrieve. |
| CancellationToken | cancellationToken | Optional cancellation token. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<ReadOnlyMemory<byte>> | The contents of the file as a blob of bytes. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission. |
| ConsensusException | If the network was unable to come to consensus before the duration of the transaction expired. |
| TransactionException | If the network rejected the request as invalid or had missing data. |
GetFileInfoAsync(ConsensusClient, EntityId, CancellationToken, Action<IConsensusContext>?)
Retrieves the details regarding a file stored on the network.
Declaration
public static Task<FileInfo> GetFileInfoAsync(this ConsensusClient client, EntityId file, CancellationToken cancellationToken = default, Action<IConsensusContext>? configure = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsensusClient | client | The Consensus Node Client to query. |
| EntityId | file | The address of the file to query. |
| CancellationToken | cancellationToken | Optional cancellation token. |
| Action<IConsensusContext> | configure | Optional callback method providing an opportunity to modify the execution configuration for just this method call. It is executed prior to submitting the request to the network. |
Returns
| Type | Description |
|---|---|
| Task<FileInfo> | The details of the network file, excluding content. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If required arguments are missing. |
| InvalidOperationException | If required context configuration is missing. |
| PrecheckException | If the gateway node rejected the request upon submission. |