question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lineReader.eachLine(...).then is not a function

See original GitHub issue

When i try to use this code sample…

var lineReader = require('line-reader');

// read all lines:
lineReader.eachLine('file.txt', function(line) {
  console.log(line);
}).then(function (err) {
  if (err) throw err;
  console.log("I'm done!!");
});

… i get this error:

}).then(function (err) { ^ TypeError: lineReader.eachLine(…).then is not a function

Do you have any idea why?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:9

github_iconTop GitHub Comments

6reactions
barroudjocommented, Mar 31, 2017

Same here… Will try to find a workaround. EDIT: solved it this way:

return new Promise((resolve, reject) => {
    lineReader.eachLine(file, function lineOperation (line, last, cb) {
      doYourThing(line, cb);
    }, function finished (err) {
      if (err) return reject(err);
      resolve();
    });
  });
5reactions
ijkl444commented, Dec 18, 2016

how can use pause and resume function in the Module? thx~

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nodejs - read line by line from file, perform async action for ...
Line by Line module helps you reading large text files, line by line, without buffering the files into memory.
Read more >
How to use lineReader.eachLine() in client side javascript ...
Line-Reader is a node.js library which read a file line-by-line , in a way in which the .txt file is arranged. ... then...
Read more >
Why You Should Stop using Line-Reader | by David Endersby
My getDynamicKeys function is set up to build and return an array, ... We pipe our file into the read stream and then...
Read more >
Readline | Node.js v19.3.0 Documentation
Once this code is invoked, the Node.js application will not terminate until ... then invokes the callback function passing the provided input as...
Read more >
function line-reader.eachLine (filename, options, iteratee, cb)
module line-reader ... function eachLine(filename, options, iteratee, cb) { if (options ... The `eachLine` function reads each line of the given file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found