Gets file contents: either a head slice (first N lines) or a 1-based line range.
Convenience method that delegates to file.buffer.get_text(). Requires file.buffer to be non-null. Ensure buffer is created before use.
This method requires file.buffer to be non-null. Ensure buffer is created before use:
if (file.buffer == null) {
file.manager.buffer_provider.create_buffer(file);
}
var all = file.contents();
Buffer must be loaded first (via read_async() or automatic loading).
from the **start** of the file:
-1 or 0 (or any value less than or equal to zero) means the **whole** file;
N > 0 means the first N lines (e.g. contents(2) is the first two lines).
**1-based inclusive** line numbers (e.g. contents(2, 5) is lines 2 through 5).
The lower and upper lines are int.min / int.max so the pair may be passed
in either order. Further bounds and clamping are handled by buffer.get_text().
| start_or_count |
Head mode: line count from the top; -1 or 0 = entire file. Range mode: first line number, **1-based inclusive** (unchanged). |
| end_line |
-1 = head mode; else end line (1-based inclusive) |
|
File contents, or empty string if not available |