Reads the whole content of a file, whose path is set in the options, and outputs it as a string.
- Service:
CleverAge\ProcessBundle\Task\File\FileReaderTask - Code:
file_reader(task: file_reader)
Input is ignored
string: raw content of the file.
Underlying method is file_get_contents.
| Code | Type | Required | Default | Description |
|---|---|---|---|---|
filename |
string |
X | Path of the file to read. An UnexpectedValueException is thrown if the file does not exist or is not readable |
# Task configuration level
entry:
task: file_reader
options:
filename: '%kernel.project_dir%/var/data/sample.txt'
outputs: [debug]- See also InputFileReaderTask to read a file path given as input.