filehandle.readLines([options])
- 
options<Object>- 
encoding<string> 默认值:null¥
encoding<string> Default:null - 
autoClose<boolean> 默认值:true¥
autoClose<boolean> Default:true - 
emitClose<boolean> 默认值:true¥
emitClose<boolean> Default:true - 
start<integer> - 
end<integer> 默认值:Infinity¥
end<integer> Default:Infinity - 
highWaterMark<integer> 默认值:64 * 1024¥
highWaterMark<integer> Default:64 * 1024 
 - 
 - 
返回:<readline.InterfaceConstructor>
¥Returns: <readline.InterfaceConstructor>
 
创建 readline 接口和流过文件的便捷方法。有关选项,请参见 filehandle.createReadStream()。
¥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);
}const { open } = require('node:fs/promises');
(async () => {
  const file = await open('./some/file/to/read');
  for await (const line of file.readLines()) {
    console.log(line);
  }
})();