GithubHelp home page GithubHelp logo

Comments (9)

barroudjo avatar barroudjo commented on July 3, 2024 6

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();
    });
  });

from line-reader.

ijkl444 avatar ijkl444 commented on July 3, 2024 5

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

from line-reader.

CanyonCasa avatar CanyonCasa commented on July 3, 2024 3

Documentation (README.md) updated on Github but not NPM site.

from line-reader.

andrhamm avatar andrhamm commented on July 3, 2024 2

Also seeing this issue...

import lineReader from 'line-reader';

export const eachLine = (filename, iteratee) => new Promise(((resolve, reject) => {
  lineReader.eachLine(filename, iteratee, (err) => {
    if (err) {
      reject(err);
    } else {
      resolve();
    }
  });
}));
await eachLine('file.txt', (line) => {
  // ...
}

from line-reader.

dannykennedy avatar dannykennedy commented on July 3, 2024 2

Reading the documentation now, this is what's recommended:

const lineReader = require("line-reader");
const Promise = require("bluebird");
const eachLine = Promise.promisify(lineReader.eachLine);
eachLine(path, function (line) {
  // do your thing
}).then(() => {
  // All the lines are read
});

from line-reader.

stevehobbsdev avatar stevehobbsdev commented on July 3, 2024

I'm seeing this as well, using version 0.4.0. Tried to follow the example as given in the documentation.

from line-reader.

trappedinspacetime avatar trappedinspacetime commented on July 3, 2024

I get the same error

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

from https://github.com/wallali/geocoder.js/blob/master/data/build.js
I don't know how to fix it.

from line-reader.

Davetherave2010 avatar Davetherave2010 commented on July 3, 2024

If you're still having issues, node has an inbuilt module that does the same (and can be easily wrapped in a promise) called readline.
Example here - https://daendersby.medium.com/stop-using-line-reader-1ad452f68155

from line-reader.

trappedinspacetime avatar trappedinspacetime commented on July 3, 2024

If you're still having issues, node has an inbuilt module that does the same (and can be easily wrapped in a promise) called readline.
Example here - https://daendersby.medium.com/stop-using-line-reader-1ad452f68155

Reading that article requires subscription. Someone can read it free in the following link:
https://stackabuse.com/reading-a-file-line-by-line-in-node-js/

from line-reader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.