Comments (9)
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.
how can use pause and resume function in the Module? thx~
from line-reader.
Documentation (README.md) updated on Github but not NPM site.
from line-reader.
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.
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.
I'm seeing this as well, using version 0.4.0. Tried to follow the example as given in the documentation.
from line-reader.
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.
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.
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)
- File not closed when finished() called. HOT 1
- output not buffer size invariant
- bug while reading an empty file HOT 1
- Update on npm HOT 5
- TypeError HOT 1
- not working on windows
- get previous line
- not working when loading the module from unit tests
- Binary file?
- Await finished function HOT 1
- What should I do if I want to insert a line to the file?
- line-reader not working after page refresh
- Promises example HOT 2
- Typescript HOT 3
- TypeError: Cannot read property 'length' of undefined
- Save to file HOT 3
- Any way to stop/abort reading a file in the eachLine method? HOT 1
- Does it save the whole file to RAM? HOT 1
- Unexpected error when calling eachLine on an empty file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from line-reader.