0

I'd want to achieve something like this:

Running my test.js via node while sending input.txt to it

node test.js < input.txt

test.js:

var data = ??????;
console.log(data);

input.txt

abc
123

Is it possible?

1

1 Answer 1

0
  serevr.js 

  var fs=require('fs');
  fs.readFile('TestFile.txt','utf8',function(err,data)
  {
   debugger;
  if(err)throw err;
  console.log(data)

   });

  cmd
  >node sever.js
Sign up to request clarification or add additional context in comments.

1 Comment

Brevity is accepted but an explanation is always more helpful :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.