Interface IArtifact
This interface holds information about an artifact.
Namespace: Unity.Cloud.Storage
Syntax
public interface IArtifact
Properties
Id
Gets the ID of the artifact.
Declaration
ArtifactId Id { get; }
Property Value
Type | Description |
---|---|
ArtifactId |
Name
Gets the name of the artifact.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
String |
SizeBytes
Gets the size of the artifact in bytes.
Declaration
long SizeBytes { get; }
Property Value
Type | Description |
---|---|
Int64 |
Version
Gets the dataset version that the artifact belongs to.
Declaration
IDatasetVersion Version { get; }
Property Value
Type | Description |
---|---|
IDatasetVersion |
Methods
DownloadFileAsync(Stream, CancellationToken)
Asynchronously downloads the artifact and writes it to a specified stream. The stream position will advance by the number of bytes downloaded.
Declaration
Task DownloadFileAsync(Stream destinationStream, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
Stream | destinationStream | The stream to which the contents of the artifact will be written. |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if data failed to be written to |
ArgumentNullException | Thrown if |
HttpRequestException | Thrown when the request fails to complete. See the returned StatusCode for more details. |
DownloadFileAsync(String, CancellationToken)
Asynchronously downloads the artifact to a specified file.
Declaration
Task DownloadFileAsync(string destinationPath, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | destinationPath | Path to file to be written. |
CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
Task | A task with no result. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if a file cannot be read. See InnerException for more details. |
ArgumentNullException | Thrown if |
HttpRequestException | Thrown when the request fails to complete. See the returned StatusCode for more details. |