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

download(id: string, path: string): Promise<void>;
download(id: string, path: string, callback: (err?: Error) => any): void;

Parameters

ParameterTypeDescription
idstringThe id of the File to download
pathstringThe path on disk to save the download to.
callback(err?: Error) => anyOptional The callback

Example

/*
 * This example demonstrates downloading a File
 */
const { CatalyticClient } = require('@catalytic/sdk');

const catalytic = new CatalyticClient();

const id = 'c9f2beec-10c0-4f2f-b4e0-1d884c7e053c';
const fileDownloadPath = '/path/to/download/location/for/file';
await catalytic.files.download(id, fileDownloadPath);

console.log(`File downloaded to "${fileDownloadPath}"`);