Download a File
Download a File to a temporary file or a given directory or file.
Permissions Required
You must have permissions to read the field that the file was uploaded to for this request to succeed.
Method Signature
FileInfo DownloadFile(Guid id, DirectoryInfo directory = null);
async Task<FileInfo> DownloadFileAsync(Guid id, DirectoryInfo directory = null);
Parameters
Parameter | Type | Description |
---|---|---|
id | Guid | The id of the File to download |
directory | DirectoryInfo | Optional The directory to save the download to. The file's original name will be preserved. Defaults to a local temporary directory. |
returns | FileInfo | A reference to the downloaded file |
FileInfo DownloadFile(string id, DirectoryInfo directory = null);
async Task<FileInfo> DownloadFileAsync(string id, DirectoryInfo directory = null);
Parameter | Type | Description |
---|---|---|
id | string | The id of the File to download |
directory | DirectoryInfo | Optional The directory to save the download to. The file's original name will be preserved. Defaults to a local temporary directory. |
returns | FileInfo | A reference to the downloaded file |
FileInfo DownloadFile(Guid id, FileInfo file);
async Task<FileInfo> DownloadFileAsync(Guid id, FileInfo file);
Parameter | Type | Description |
---|---|---|
id | Guid | The id of the File to download |
file | FileInfo | The file name and path to save the download to. The file's original name will not be used. |
returns | FileInfo | A reference to the downloaded file |
FileInfo DownloadFile(string id, FileInfo file);
async Task<FileInfo> DownloadFileAsync(string id, FileInfo file);
Parameter | Type | Description |
---|---|---|
id | string | The id of the File to download |
file | FileInfo | The file name and path to save the download to. The file's original name will not be used. |
returns | FileInfo | A reference to the downloaded file |
Example
/*
* This example demonstrates downloading a File
*/
using Catalytic.Sdk.Entities;
namespace Catalytic.Sdk.Examples
{
class Program
{
static void Main(string[] args)
{
var catalytic = new Catalytic.Sdk.Client(Credentials.Default);
var file = catalytic.Files.DownloadFile(\"8d20bdf5-d3bb-4a08-b05b-eb22a8b5c300\");
Console.WriteLine($\"File downloaded to {file.FullName}\");
}
}
}
Updated almost 4 years ago