Download a File

Download a File to a temporarily 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(string $id, string $directory = null): SplFileObject


$idstringThe id of the File to download
$directorystringOptional The directory to save the download to. The file's
original name will be preserved. Defaults to a local temporary directory.
returnsSplFileObjectThe downloaded File



 * This example demonstrates downloading a File

require_once(__DIR__ . '/vendor/autoload.php');

use Catalytic\SDK\CatalyticClient;

$catalytic = new CatalyticClient();
$file = $catalytic->files()->download('924cd388-addb-42f7-913e-24c9beb17635');

echo "File downloaded to " . $file->getPathname() . PHP_EOL;