Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 1.37 KB

input_line_reader_task.md

File metadata and controls

49 lines (37 loc) · 1.37 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
  • Code: input_line_reader (task: input_line_reader)
  • 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. Without DROP_NEW_LINE, the lines keep their line break, so an empty line is output as "\n" (only the empty string after the last line break is skipped).

Options

This task has no option.

Examples

  • Read every line of every file of a folder
# Task configuration level
entry:
  task: folder_browser
  options:
    folder_path: '%kernel.project_dir%/var/data'
  outputs: [read]
read:
  task: input_line_reader
  outputs: [log_line]