BLAST

POST/v1/vms/{id}/sync

Read or write a file inside a VM.

Request

The body is discriminated by op.

Read

json
{ "op": "read", "path": "/absolute/or/relative/path" }

Write

{ "op": "write", "writes": [...] }, where each entry is:

path
String
Required
Destination path inside the VM.
content
String
Required
The file's bytes. BLAST tries to base64-decode this first; if it isn't valid base64, it writes the literal text instead.

Each write replaces the destination file in full. start/end byte ranges and presigned uploads (presigned: true) are accepted in the request shape for forward compatibility but are not implemented by this worker today; a presigned write returns an error result for that entry.

Response

A read returns:

ok
Bool
true on success.
path
String
Echoes the request path.
size
Int
Byte length of content.
content, encoding
String, "utf-8" | "base64"
The file's bytes and how they're encoded. Content that isn't valid UTF-8 comes back base64-encoded.

A write returns { "ok": ..., "op": "write", "results": [...] }, one result per request entry:

received_bytes
Int
Bytes decoded from content.
complete, written
Bool
true once the file is written.
error
String
Set instead of the above when this entry failed (e.g. missing content, or presigned: true).

Example

bash
curl -X POST localhost:7240/v1/vms/$VM/sync \
  -H "Content-Type: application/json" \
  -d '{"op":"read","path":"/tmp/hello.txt"}'