storage:local:file:read
Reads the full contents of a file and returns it as both a string and raw bytes
Options
| Name | Type | Description |
|---|---|---|
path | string | Path to the file to read, resolved inside the host's file root |
Outputs
| Name | Type | Description |
|---|---|---|
content | string | File contents as a UTF-8 string |
body | []byte | File contents as raw bytes |
Examples
name: Read a config file
actions:
- name: config
component: storage:local:file:read
vars:
path: ./config.json
outputs:
config: "{{ config.body | from:'json' }}"name: Read an uploaded file for document processing
actions:
- name: source
component: app:file:read
vars:
schema: content
table: files
record_id: "{{ var.file_id }}"
field: source
- name: selected
component: data:document:select
vars:
format: xml
content_base64: "{{ source.content_base64 }}"
locator: /resources/string
outputs:
filename: "{{ source.filename }}"
entries: "{{ selected.matches }}"