KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to read a large file one line at a time. I found a question on Quora that dealt with the subject but I'm missing some connections to make the whole thing fit together. var Lazy=require("lazy"); new Lazy(process.stdin) .lines .forEach( function(line) { console.log(line.toString()); } ); process.stdin.resume(); The bit that I'd like to figure out is how I might read one line at a time from a file instead of STDIN as in this sample. I tried: fs.open('./VeryBigFile.csv', 'r', '0666', Process); function Process(err, fd) { if (err) throw err; // DO lazy read } but it's not working. I know that in a pinch I could fall back to using something like PHP, but I would like to figure this out. I don't think the other answer would work as the file is much larger than the server I'm running it on has memory for.
Tags (comma-separated)
Save Edits
Cancel