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

ParameterTypeDescription
idGuidThe id of the File to download
directoryDirectoryInfoOptional The directory to save the download to. The file's
original name will be preserved. Defaults to a local temporary directory.
returnsFileInfoA reference to the downloaded file
FileInfo DownloadFile(string id, DirectoryInfo directory = null);
async Task<FileInfo> DownloadFileAsync(string id, DirectoryInfo directory = null);
ParameterTypeDescription
idstringThe id of the File to download
directoryDirectoryInfoOptional The directory to save the download to. The file's
original name will be preserved. Defaults to a local temporary directory.
returnsFileInfoA reference to the downloaded file
FileInfo DownloadFile(Guid id, FileInfo file);
async Task<FileInfo> DownloadFileAsync(Guid id, FileInfo file);
ParameterTypeDescription
idGuidThe id of the File to download
fileFileInfoThe file name and path to save the download to. The file's original
name will not be used.
returnsFileInfoA reference to the downloaded file
FileInfo DownloadFile(string id, FileInfo file);
async Task<FileInfo> DownloadFileAsync(string id, FileInfo file);
ParameterTypeDescription
idstringThe id of the File to download
fileFileInfoThe file name and path to save the download to. The file's original
name will not be used.
returnsFileInfoA 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}\");
        }
    }
}