Skip to main content
from gravixlayer import GravixLayer

client = GravixLayer()
runtime = client.runtime.create(template="python-3.12-base-small")

listing = client.runtime.list_files(runtime.runtime_id, path="/workspace")

for item in listing.files:
    kind = "dir" if item.is_dir else "file"
    print(f"{item.name}  {kind}  {item.size} bytes")

client.runtime.kill(runtime.runtime_id)

Parameters

ParameterTypeRequiredDescription
runtime_idstringYesRuntime identifier
pathstringYesDirectory path

Response

Each entry in listing.files:
FieldTypeDescription
namestringFile or directory name
sizeintegerSize in bytes
is_dirbooleanTrue if directory
modified_atstringLast modified timestamp
modestringFile permissions