Function: uploadFile()
uploadFile(
client,props):Promise<string>
Uploads a file and returns the upload token. This helper function infers the MIME type from the file extension, prepares the upload, and uploads the file to the signed URL.
Parameters
client
The API client instance
props
The upload properties
Returns
Promise<string>
Promise resolving to the upload token
Example
import { readFile } from 'node:fs/promises';
import { basename } from 'node:path';
const fileData = await readFile('model.glb');
const filename = basename('model.glb');
const uploadToken = await uploadFile(client, {
params: { orgName: 'my-org', projectName: 'my-project' },
fileData,
filename,
});