Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 1.24 KB

File metadata and controls

47 lines (35 loc) · 1.24 KB

InputLineReaderTask

Reads a file, whose path is given as input, and iterates over its lines, outputting each line as a string. Same behaviour as LineReaderTask, except for the file path.

Task reference

  • Service: CleverAge\ProcessBundle\Task\File\InputLineReaderTask
  • Iterable task

Accepted inputs

string: path of the file to read. An \UnexpectedValueException is thrown if the file does not exist or is not readable. The file is released once fully read, so each input (the same path again or a different one) is read from its beginning.

Possible outputs

string: for each line, its raw content. The line break is not removed. Underlying class is SplFileObject, with the READ_AHEAD and SKIP_EMPTY flags.

Options

This task has no option.

Examples

  • Read every line of every file of a folder
# Task configuration level
entry:
  service: '@CleverAge\ProcessBundle\Task\File\FolderBrowserTask'
  options:
    folder_path: '%kernel.project_dir%/var/data'
  outputs: [read]
read:
  service: '@CleverAge\ProcessBundle\Task\File\InputLineReaderTask'
  outputs: [log_line]