File.read
File.read($filePath, $options = {}) -> list|string
Description
Read an entire file and return the List of lines.
The $filePath
is relative to the data/files
directory.
$lines = File.read('path/to/file.txt') foreach $lines as $line { ... }
NoteThis function reads the entire file into memory. For large files, use File.readLines instead.
Options
Option | Value | Description |
---|---|---|
join |
true/false | Return a string where the lines are joined by newlines. |
$fullText = File.read('path/to/file.txt', -join)