Transfer Files
Use runta cp or SDK file helpers to copy files between your local machine and
a runtime.
Start a runtime:
runta run --name demo --cpus 1 --memory 512from runta import Runta
runta = Runta()runtime = runta.runtimes.create("demo", vcpus=1, memory_mib=512)import { Runta } from "@runta/runta-sdk";
const runta = new Runta();const runtime = await runta.runtimes.create("demo", { vcpus: 1, memoryMib: 512,});Copy a file from the runtime to your local machine:
runta exec demo -- sh -lc 'echo hello-from-runtime > /tmp/message.txt'runta cp demo:/tmp/message.txt ./message.txtcat message.txtawait runtime.exec("echo hello-from-runtime > /tmp/message.txt");await runtime.files.download("/tmp/message.txt", "./message.txt");Copy a local file into the runtime:
echo "hello world" > hello.txtrunta cp hello.txt demo:/runta exec demo cat /hello.txtawait runtime.files.upload("./hello.txt", "/hello.txt");
const text = await runtime.files.readText("/hello.txt");console.log(text);