function readLines
readLines(path: string | URL): Enumerable<string>

Read a file as lines of text.

This is a convenience function equivalent to read(path).lines. Useful for developers who expect a direct readLines function.

Examples

Read file lines

import { readLines } from "jsr:@j50n/proc";

const lines = await readLines("data.txt").collect();
// Array of strings, one per line

Parameters

path: string | URL

The path of the file.

Return Type

Enumerable<string>

An Enumerable of text lines.

Usage

import { readLines } from ".";