11 lines
346 B
TypeScript
11 lines
346 B
TypeScript
import fs from "fs";
|
|
import readline from "readline";
|
|
|
|
/**
|
|
* Creates a line-by-line reader stream for a given file path.
|
|
*/
|
|
export function createLineReader(sourcePath: string): readline.Interface {
|
|
const fileStream = fs.createReadStream(sourcePath, "utf-8");
|
|
|
|
return readline.createInterface({ input: fileStream, crlfDelay: Infinity });
|
|
}
|