Skip to main content

# Read File As Lines (LCC.web_file.get_lines)

## Signature​

    lines, err = LCC.web_file.get_lines(path, timeout?)

## Parameters​

- path
  String. File path to read.
- timeout
  Number, optional. Request timeout in seconds, default `60`.

## Returns​

- lines
  Table. Array of lines with normalised `\n` endings; `nil` on failure.
- err
  String or `nil`. Error description when the call fails.

## Notes​

> Reads the entire file and splits it into a line array.
> `\r\n` is normalised to `\n` before splitting.

## Example​

    local lines, err = LCC.web_file.get_lines("/config/list.txt")
    if not lines then
        error(err)
    end
    print("Lines:", #lines)