from gravixlayer import GravixLayer
client = GravixLayer() # defaults to cloud="aws", region="us-east-1"
sandbox = client.runtime.create() # defaults to template="base-small"
# Write a file first so we have something to stat
sandbox.file.write("/workspace/output.txt", "hello\n")
info = sandbox.file.get_info("/workspace/output.txt")
if info.exists and info.info:
f = info.info
print(f"Permissions: {f.permissions}")
print(f"Mode (octal): {f.mode}")
print(f"Size: {f.size}")
sandbox.kill()
import { GravixLayer } from 'gravixlayer';
const client = new GravixLayer(); // defaults to cloud="aws", region="us-east-1"
const sandbox = await client.runtime.create(); // defaults to template="base-small"
// Write a file first so we have something to stat
await sandbox.file.write("/workspace/output.txt", "hello\n");
const info = await sandbox.file.getInfo("/workspace/output.txt");
if (info.exists && info.info) {
const f = info.info;
console.log(`Permissions: ${f.permissions}`);
console.log(`Mode (octal): ${f.mode}`);
console.log(`Size: ${f.size}`);
}
await sandbox.kill();
gravixlayer runtime files info "$RT" /workspace/local.py
curl -X POST "https://api.gravixlayer.ai/v1/agents/runtime/$RT/files/info" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"path": "/workspace/local.py"}'
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Path to stat |
Response
| Field | Type | Description |
|---|---|---|
exists | boolean | Whether the path exists |
info | FileInfo or None | Metadata when exists is true |
FileInfo includes name, path, size, is_dir, mode (octal string), permissions (e.g. rw-r--r--), and modified_at.
Endpoint
POST /v1/agents/runtime/{runtime_id}/files/info