Example: File ingest and ETL
You use this pattern when your backend receives files (CSV, JSON, logs, archives) and you want to process them with standard Unix or language CLIs inside an isolated VM. You upload into a known path, youexec transformation steps, you download artifacts.
What you accomplish
You move data in withuploadFile / upload_file, you run deterministic commands (awk, python -c, jq if installed, etc.), you read output files back with downloadFile / download_file. You delete the sandbox when the job completes so you do not store customer data longer than necessary.
Concepts you use
- Paths: You choose paths under
/tmpor/workconsistently so you avoid clashing with image layout. - Binary vs text:
downloadFile/download_filereturns bytes in Python; you decode explicitly with the right encoding. - Large files: You use stream APIs (
uploadFileStream,downloadFileStream) when files exceed comfortable memory: see File system.
Prerequisites
You completed Examples overview.Step 1: Create sandbox and upload input
Step 2: Transform in place
You run a shell pipeline. You redirect output to/work/output.csv. You check exit code before you download.
You adjust the
awk line for your real schema. When logic grows beyond one line, you upload a script file and exec python /work/transform.py instead.Step 3: Download the result
Step 4: Optional Python transform instead of awk
You upload a.py file and you execute it. You keep user logic out of the shell string when the transform is complex.
Step 5: Clean up
Practices you should follow
- You validate uploads (size, type, virus scanning at the edge) before you upload to VoidRun.
- You use random subdirectory names per job when you run concurrent ETL to avoid path clashes inside one sandbox (or you use one sandbox per job).
- You prefer streaming APIs for multi‑GB files.
Related guides
File system
Streams, archives, permissions
Multi-step job
Longer pipelines in one VM

