Overview
One-shot execution is the simplest way to use buntime.sh. Perfect for quick calculations, data transformations, or testing code snippets without needing persistent state.When to Use One-Shot Execution
Use one-shot execution when you need to:- ✅ Run quick calculations or algorithms
- ✅ Test a code snippet
- ✅ Process data without saving files
- ✅ Verify API responses
- ✅ Run independent tasks
- ❌ Files to persist between executions
- ❌ Multiple related code executions
- ❌ Long-running processes
- ❌ Stateful operations
Quick Example
Simple Calculations
Mathematical Operations
Statistical Analysis
String Processing
Text Transformation
Regular Expressions
Array and Object Operations
Array Manipulation
Data Validation
Schema Validation with Zod
API Requests
Fetch External Data
POST Request
Date and Time Operations
Error Handling
Always check the exit code and stderr:Using REST API Directly
For one-shot executions, you can use the REST API without an SDK:Best Practices
Set short TTLs
Set short TTLs
For one-shot executions, use a short TTL (5-10 minutes) to automatically clean up sessions.
Always clean up
Always clean up
Delete sessions when done to free resources immediately.
Check exit codes
Check exit codes
Always verify the execution succeeded before using results.
Handle errors gracefully
Handle errors gracefully
Wrap risky operations in try-catch blocks in your code.
Common Use Cases
Data Transformation
Convert between formats (JSON, CSV, XML)
Quick Calculations
Mathematical operations and statistics
API Testing
Test external APIs and parse responses
String Processing
Text manipulation and regex operations