Skip to main content
promises.FileHandle.readLines - fs - Node documentation
method promises.FileHandle.readLines

Usage in Deno

import { type promises } from "node:fs";
FileHandle.readLines(options?: CreateReadStreamOptions): ReadlineInterface

Convenience method to create a readline interface and stream over the file. See filehandle.createReadStream() for the options.

import { open } from 'node:fs/promises';

const file = await open('./some/file/to/read');

for await (const line of file.readLines()) {
  console.log(line);
}

Parameters

optional
options: CreateReadStreamOptions

Return Type

ReadlineInterface