9

I wish to send some parameters when running a node script, using for instance

node myscript.js

from the terminal, so it can be read as below:

const fs = require('fs');

console.log(myParameter);

1 Answers1

9

You just need to call as many arguments as you want, like:

node myscript.js arg1 arg2 arg3

And you recover them like:

console.log(process.argv[2]);