Skip to content

file

Source

Hook to read or write a file.

Inputs

Name Type Default Required Description
path str True Path to read a file or write file if contents are given.
contents Any None False If writing to file, the contents to write.

Arguments

Position Argument Type
1 path str
2 contents Any

Returns

Optional[str]

Examples

Read a file

Read a file into a variable as a string.

compact->: file path/to/file/to/read
expanded:
  ->: file
  path: path/to/file/to/read

Write to a file

Write to a file with contents.

stuff: |
  and things...
compact->: file path/to/file/to/write {{stuff}}
expanded:
  ->: file
  path: path/to/file/to/read
  contents: {{stuff}}