javascript – WebStorm Run JS File with Stdin argument – Code Utility

[

I’ve got an interview and I’ve been messing around with C++, but then the company suddenly asked me to solve the questions with JS. I’m not acquainted with Node so much.

I want to configure my IDE such that it will run entry.js as such:

node entry.js < Input.txt

So that it can receive the input from Input.txt with the following boilerplate:

const fs = require('file-system');

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', function (inputStdin) {
    inputString += inputStdin;
});

process.stdin.on('end', function () {
    inputString = inputString.split('\n');

    main();
});

I don’t want to add readline interface or etc. since I want to use the code as-is.
Each time I want to run my application, I don’t want to bother to write it down from the terminal again and again. I want to run my application from the IDE so as to it will run with changed stdin.
How can it be configured as I want?

]