Upload a File
Upload one or more new Files to Catalytic.
Method Signature
upload(filePath: string): Promise<FileMetadata>;
upload(filePath: string, callback: (err?: Error, fileMetadata: FileMetadata) => any): void;
Parameters
Parameter | Type | Description |
---|---|---|
filePath | string | The path to the file to upload |
returns | File | The metadata for the uploaded file |
Example
/*
* This example demonstrates uploading a File to Cataltyic
*/
const { CatalyticClient } = require('@catalytic/sdk');
const catalytic = new CatalyticClient();
const filePath = '/path/to/file/to/upload';
const fileMetadata = await catalytic.files.upload(filePath);
console.log(`Uploaded file has ID "${fileMetadata.id}"`);
Updated almost 2 years ago