Skip to content

Files

Runta file helpers move data between your local machine and one runtime. The REST API exposes raw single-file reads and writes. The CLI and SDKs build higher-level copy, upload, and download workflows on top of those file routes and command execution.

The CLI uses <runtime>:<path> for remote paths:

Terminal window
runta cp ./app.py worker:/tmp/app.py
runta cp worker:/tmp/result.json ./result.json
runta cp ./src worker:/tmp/src

Use absolute remote paths when possible. Relative local paths are resolved by your shell before the CLI sends the file.

from runta import Runta
with Runta() as runta:
runtime = runta.runtimes.create("file-demo")
runtime.files.write("/tmp/message.txt", "hello")
print(runtime.files.read("/tmp/message.txt").decode())
runtime.files.upload("./local-file.txt", "/tmp/local-file.txt")
runtime.files.download("/tmp/local-file.txt", "./downloaded-file.txt")

Python read() returns bytes. TypeScript read() returns Uint8Array, and readText() decodes the bytes as text.

The REST routes operate on one regular file at a time:

Terminal window
curl -sS "$RUNTA_ENDPOINT/v1/runtimes/worker/files?path=/tmp/message.txt" \
-H "Authorization: Bearer $RUNTA_TOKEN"
Terminal window
curl -sS -X PUT "$RUNTA_ENDPOINT/v1/runtimes/worker/files?path=/tmp/message.txt" \
-H "Authorization: Bearer $RUNTA_TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary @message.txt

The response for a successful write is 204 No Content.

Directory upload support is SDK-implemented:

InterfaceBehavior
CLICopies directories through runta cp using the CLI transfer implementation.
Python SDKArchives the directory as a tar stream and extracts it inside the runtime through exec.
TypeScript SDKWalks the directory and writes each file to the matching remote path.
REST APISupports single-file raw byte read and write routes only.

If a runtime does not have standard shell utilities available, prefer single file writes through the REST route or SDK write() method.