Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vsemozhetbyt opened this issue Feb 6, 2018 · 0 comments
Labels
promises Issues and PRs related to ECMAScript promises. readline Issues and PRs related to the built-in readline module.

Comments

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Feb 6, 2018

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';

const readline = require('readline');
const fs = require('fs');

async function processLineByLine(filePath) {
  const rli = readline.createInterface({
    input: fs.createReadStream(filePath),
    crlfDelay: Infinity
  });

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

processLineByLine('config.ini').catch(console.error);

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

An association: Perl <FILEHANDLE> operator.

@vsemozhetbyt vsemozhetbyt added readline Issues and PRs related to the built-in readline module. promises Issues and PRs related to ECMAScript promises. labels Feb 6, 2018
TimothyGu added a commit to TimothyGu/node that referenced this issue Nov 20, 2018
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: nodejs#18603
Refs: nodejs#18904
@Trott Trott closed this as completed in 2a7432d Nov 20, 2018
targos pushed a commit that referenced this issue Nov 21, 2018
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: #18603
Refs: #18904
PR-URL: #23916
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
rvagg pushed a commit that referenced this issue Nov 28, 2018
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: #18603
Refs: #18904
PR-URL: #23916
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
refack pushed a commit to refack/node that referenced this issue Jan 14, 2019
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: nodejs#18603
Refs: nodejs#18904
PR-URL: nodejs#23916
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
BethGriggs pushed a commit that referenced this issue Apr 17, 2019
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: #18603
Refs: #18904
PR-URL: #23916
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
BethGriggs pushed a commit that referenced this issue Apr 28, 2019
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: #18603
Refs: #18904
PR-URL: #23916
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
MylesBorins pushed a commit that referenced this issue May 16, 2019
Co-authored-by: Ivan Filenko <ivan.filenko@protonmail.com>
Fixes: #18603
Refs: #18904
PR-URL: #23916
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
promises Issues and PRs related to ECMAScript promises. readline Issues and PRs related to the built-in readline module.
Projects
None yet
Development

No branches or pull requests

1 participant