head function

HeadProgress head(
  1. String path,
  2. int lines
)

Prepares to read count lines from the file at path.

The head function returns a HeadProgress which can then be used to read the configured lines via one of HeadProgress methods.

head('/var/log/syslog', 10).forEach((line) => print(line));

Throws a core.HeadException exception if path is not a file.

Implementation

HeadProgress head(String path, int lines) =>
    HeadProgress._internal(path, lines);