Files
Transfer Files
Section titled “Transfer Files”echo "hello from local" > local-file.txtrunta cp local-file.txt demo:/tmp/local-file.txt
runta exec demo -- sh -lc 'echo "hello from runtime" > /tmp/result.txt'runta cp demo:/tmp/result.txt ./result.txtUse absolute remote paths when possible. Relative local paths are resolved by your shell before the CLI sends the file.
from pathlib import Pathfrom runta import Runta
with Runta() as runta: runtime = runta.runtimes.create("demo")
runtime.files.write("/tmp/message.txt", "hello") print(runtime.files.read("/tmp/message.txt").decode())
Path("local-file.txt").write_text("hello from local") runtime.files.upload("local-file.txt", "/tmp/local-file.txt") runtime.files.download("/tmp/local-file.txt", "./downloaded-file.txt")import { writeFile } from "node:fs/promises";import { Runta } from "@runta/runta-sdk";
const runta = new Runta();const runtime = await runta.runtimes.create("demo");
await runtime.files.write("/tmp/message.txt", "hello");console.log(await runtime.files.readText("/tmp/message.txt"));
await writeFile("local-file.txt", "hello from local");await runtime.files.upload("local-file.txt", "/tmp/local-file.txt");await runtime.files.download("/tmp/local-file.txt", "./downloaded-file.txt");Transfer Directories
Section titled “Transfer Directories”runta cp ./local-dir demo:/workspace/local-dirrunta cp demo:/workspace/results ./resultsruntime.files.upload("./local-dir", "/workspace/local-dir")runtime.files.download("/workspace/results", "./results")await runtime.files.upload("./local-dir", "/workspace/local-dir");await runtime.files.download("/workspace/results", "./results");If an environment does not have standard shell utilities such as sh, mkdir,
tar, or chmod available, prefer single-file writes through the SDK methods.
Quick Reference
Section titled “Quick Reference”Use the Runta CLI for terminal workflows, shell scripts, and direct runtime operations.
| Task | CLI command |
|---|---|
| Upload a file | runta cp ./local.txt demo:/tmp/local.txt |
| Download a file | runta cp demo:/tmp/result.txt ./result.txt |
| Upload a directory | runta cp ./local-dir demo:/workspace/local-dir |
| Download a directory | runta cp demo:/workspace/results ./results |
| Read a file | runta exec demo -- cat /tmp/message.txt |
| Write a file | runta exec demo -- sh -lc 'echo hello > /tmp/message.txt' |
Use these calls after creating or resolving a Python runtime handle such as runtime.
| Task | Python SDK |
|---|---|
| Upload a file | runtime.files.upload("./local.txt", "/tmp/local.txt") |
| Download a file | runtime.files.download("/tmp/result.txt", "./result.txt") |
| Upload a directory | runtime.files.upload("./local-dir", "/workspace/local-dir") |
| Download a directory | runtime.files.download("/workspace/results", "./results") |
| Read a file | runtime.files.read("/tmp/message.txt") |
| Write a file | runtime.files.write("/tmp/message.txt", "hello") |
Use these promise-based calls after creating or resolving a TypeScript runtime handle.
| Task | TypeScript SDK |
|---|---|
| Upload a file | await runtime.files.upload("./local.txt", "/tmp/local.txt") |
| Download a file | await runtime.files.download("/tmp/result.txt", "./result.txt") |
| Upload a directory | await runtime.files.upload("./local-dir", "/workspace/local-dir") |
| Download a directory | await runtime.files.download("/workspace/results", "./results") |
| Read a file | await runtime.files.readText("/tmp/message.txt") |
| Write a file | await runtime.files.write("/tmp/message.txt", "hello") |
