Upload and download files.
Automatic Upload
Base64 and data URIs are uploaded automatically:
typescript
1const result = await client.run({2 app: 'image-processor',3 input: {4 image: 'data:image/png;base64,...' // Uploaded automatically5 }6});Manual Upload
From Base64
typescript
1const file = await client.uploadFile('data:image/png;base64,...', {2 filename: 'image.png',3 contentType: 'image/png'4});56console.log('URI:', file.uri);From Blob (Browser)
typescript
1const blob = new Blob([arrayBuffer], { type: 'image/png' });23const file = await client.uploadFile(blob, {4 filename: 'image.png'5});Upload Options
typescript
1interface UploadFileOptions {2 filename?: string; // File name3 contentType?: string; // MIME type4 path?: string; // Custom storage path5 public?: boolean; // Make publicly accessible6}Use Uploaded Files
typescript
1const file = await client.uploadFile(data, { filename: 'image.png' });23const result = await client.run({4 app: 'image-processor',5 input: { image: file.uri }6});Download Results
typescript
1const result = await client.run(params);2const outputUrl = result.output.image.uri;34// Download5const response = await fetch(outputUrl);6const blob = await response.blob();