Skip to content

readline: add support for asynchronous iteration (tracking feature request)#18603

@vsemozhetbyt

Description

@vsemozhetbyt

An issue to not forget.

It would be handy to sync readline API with for-await support in readable streams, so we can do something like this (compare examples here and here):

'use strict';constreadline=require('readline');constfs=require('fs');asyncfunctionprocessLineByLine(filePath){constrli=readline.createInterface({input: fs.createReadStream(filePath),crlfDelay: Infinity});forawait(constlineofrli){console.log(line);}}processLineByLine('config.ini').catch(console.error);

An evidence of need: "Alas" from Axel Rauschmayer.

An association: Perl <FILEHANDLE> operator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    promisesIssues and PRs related to ECMAScript promises.readlineIssues and PRs related to the built-in readline module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions