Doel
Read a request-scoped Element artifact file visible to the current run.
Elements runtime reference / Request artifacts
readFileRead a request-scoped Element artifact file visible to the current run.
readFile(path, bucket=None, prefix=None, encoding='utf-8', asBytes=False, maxBytes=None, withMetadata=False)
Read a request-scoped Element artifact file visible to the current run.
read_filefiles.readfiles.read_fileUse these fields as the Python call arguments or keyword payload for this helper.
{
"path": "exports/preview.json",
"encoding": "utf-8",
"withMetadata": true
}
| Field | Description |
|---|---|
path | Relative artifact path or worker-returned artifact reference visible to the current run. |
bucket/prefix | Optional worker-controlled artifact bucket/prefix override. |
encoding | Text encoding used when asBytes is false. |
asBytes | When true, return metadata with base64 data instead of decoded text. |
maxBytes | Optional read cap bounded by the worker. |
withMetadata | When true, return the full metadata envelope even for text reads. |
{
"path": "exports/preview.json",
"contentType": "application/json",
"encoding": "utf-8",
"text": "{\"title\":\"Preview\"}",
"size": 19
}
def run():
metadata = files.read("exports/preview.json", withMetadata=True)
return {"text": metadata["text"]}