Execute Atomic Tasks with function.do
Leverage single-purpose, composable functions via API or SDK. Build powerful workflows by combining these fundamental building blocks.
Join waitlistimport { Do } from '@do Leda';
const doLeda = new Do('');
// Define parameters for a hypothetical 'image-resize' function
interface ImageResizeParams {
sourceUrl: string;
width: number;
height: number;
outputFormat: 'jpeg' | 'png' | 'webp';
}
async function resizeImage(params: ImageResizeParams) {
try {
// Invoke the specific function.do endpoint
const result = await doLeda.run('function.do/image-resize', params);
console.log('Image resized successfully:', result);
// result might contain { resizedUrl: '...', size: 12345 }
return result;
} catch (error) {
console.error('Failed to resize image:', error);
throw error;
}
}
// Example usage:
resizeImage({
sourceUrl: 'https://example.com/large-image.jpg',
width: 800,
height: 600,
outputFormat: 'webp'
});