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; relative paths are resolved from the pipeline cwd |
Outputs
| Name | Type | Description |
|---|---|---|
content | string | File contents as a UTF-8 string |
body | []byte | File contents as raw bytes |
Example
name: Read a config file
actions:
- name: config
component: file:read
vars:
path: ./config.json
outputs:
config: "{{ config.body | from:'json' }}"