Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8551847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:17:11+00:00 2026-06-11T14:17:11+00:00

I am using Node v.0.8.9, and its module readline . I cannot use fs.readFile()

  • 0

I am using Node v.0.8.9, and its module readline. I cannot use fs.readFile() since I get EISDIR error.

I would like to read line by line from a file, do some work, and only then (when the work is complete) to read the next line. Thus, I tried the following snippet (see below) but when changing the for with some synchronous work, it does not behave synchronously.

var fs = require('fs');
var readline = require("readline");
var filename = process.argv[2];

readline.createInterface({
    input: fs.createReadStream(filename),
    terminal: false
}).on("line", function(line){
   this.emit("pause", line);
}).on("pause", function(line) {
    console.log("pause");
    console.log(line);
    console.log("doing some work");
    for (var i = 0; i < 1000000000; ++i);
    this.emit("resume");
}).on("resume", function() {
    console.log("resume");
}).on("close", function() {
    console.log("close");
});

Could one shed the light on the issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:17:12+00:00Added an answer on June 11, 2026 at 2:17 pm

    Although it is common to read line by line from a file, NodeJS has no implementation for supporting such big files. Hence, you will need to implement it using a buffer.

    Here is one which works beautifully – http://blog.jaeckel.com/2010/03/i-tried-to-find-example-on-using-node.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to select a node and modify its attributes and child-nodes using
I would like to use the CommonJS module system in a clientside javascript application.
I have a few applications which use the fantastic node-sqlite3 module. Its one drawback
I have the following express node.js app. It's using the 'redis' npm package. app.get(/test,function(req,res){
When using node.js to e.g. serve requests for a backbone.js front end, would node.js
Erlang support to partition its nodes into groups using the global_group module. Further, Erlang
Pre-abmle: I am using MakeMeeting module to create/display meeting polls. This module has its
I'm doing some content importing using the node import module in drupal. My problem
Im using Node.js 0.6.2 on Windows 7 I managed to get the dependencies solved
We have developed chat module using node.js() and mongo sharding and gone live to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.