Get a File

Get metadata for a File by ID.

๐Ÿ‘

Permissions Required

You must have View permissions to the field this file was uploaded to for this request to succeed

Method Signature

get(id: string): Promise<FileMetadata>;
get(id: string, callback: (err?: Error, file: FileMetadata) => any): void;

Parameters

ParameterTypeDescription
idstringThe id of the File to get
callback(err?: Error, file: FileMetadata) => anyOptional The callback
returnsFileThe requested file metadata

Example

/*
 * This example demonstrates getting a File's metadata by ID
 */
const { CatalyticClient } = require('@catalytic/sdk');

const catalytic = new CatalyticClient();

const fileMetadata = await catalytic.files.get('c9f2beec-10c0-4f2f-b4e0-1d884c7e053c');
console.log(`Name: ${fileMetadata.name}`);
console.log(`Size: ${fileMetadata.displaySize}`);
console.log(`Content-Type: ${fileMetadata.contentType}`);