Linked Questions
64 questions linked to/from How do I pass command line arguments to a Node.js program and receive them?
10
votes
1
answer
10k
views
How to pass parameter when executing a node.js script? [duplicate]
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
votes
1
answer
2k
views
How to read user input directly in Node.js [duplicate]
From the following code I can read and console.log the line
const readline = require('readline');
const { stdin: input, stdout: output } = require('process');
const rl = readline.createInterface({ ...
1
vote
1
answer
273
views
How to pass variable from python3 to javascript? [duplicate]
I make a connection with DB and select some information with a query in a python file. All information is stored in a variable. Then I start a js, but I want to send this information from python to ...
5
votes
0
answers
114
views
Loopback | command line argument for loading data [duplicate]
For my Loopback project, I need to load a huge data set from csv.
Boot script takes nearly 30s to complete the data load. so its not an option.
My plan is to load data only when loop back is started ...
0
votes
0
answers
56
views
How to pass an argument to a function in Node.js? [duplicate]
So far this is my code:
function number(numm){
var ones = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
var result;
var numString = num.toString();
if (num ==...
1520
votes
26
answers
1.1m
views
Sending command line arguments to npm script
The scripts portion of my package.json currently looks like this:
"scripts": {
"start": "node ./script.js server"
}
...which means I can run npm start to start the ...
user avatar
user291545
365
votes
17
answers
361k
views
Run function in script from command line (Node JS)
I'm writing a web app in Node. If I've got some JS file db.js with a function init in it how could I call that function from the command line?
49
votes
5
answers
41k
views
Make a script which accept command-line arguments
What is the correct syntax for running a Node.js script with command-line arguments on Linux or Mac?
To run the script with no arguments, I would simply use the command node stuff.js, but in this ...
11
votes
4
answers
17k
views
How do you pass a string as an argument to Node from the command-line?
I'm new to Node and I'm trying to write a command-line tool in Node that would allow you to pass a string in as an argument.
I saw that Node seems to break each word passed in as an array when using ...
5
votes
1
answer
6k
views
Node.js : how to pass parameter's value from terminal to JS script
Given a jsdom based svgcreator.node.js script file :
var jsdom = require('jsdom');
jsdom.env(
"<html><body></body></html>", // CREATE DOM HOOK
[ 'http://d3js.org/d3....
16
votes
3
answers
2k
views
Google Maps and SQL Server LINESTRING length inconsistent
Google Maps and MSSQL seem to disagree on how to calculate the distance/length of a polyline/linestring using SRID 4326.
MSSQL:
SELECT geography::STGeomFromText('LINESTRING(-98.78 39.63,2.98 27.52)',...
9
votes
1
answer
5k
views
How to pass a command line argument to a nested script?
NOTE: This is NOT about sending args to the top-level script, but to the script called by that script
In my package.json, when I call a script that takes command line args directly, it works. But ...
5
votes
3
answers
4k
views
How can I dynamically pass arguments to a node script using unix commands?
# index.js
console.log(process.argv) // expect this to print [.., .., '1']
# terminal
$ echo 1 | node index.js // just prints [.., ..]
What's the trick? How do I dynamically pass arguments to a node ...
6
votes
3
answers
12k
views
Node.js TypeError: path must be a string or Buffer
I'm writting a command line program which calculates the total price of an order, using info from a CSV file.
Data inside sample.catalog.csv:
P1,5,1000.00
P2,8,250.00
P3,15,125.00
P4,10,250.00
P5,2,...
3
votes
1
answer
6k
views
How to pass .json file name as argument to command line in node.js
I run app.js with command node app.js
It executes const inputData = require('./input.json');
Is it possible pass file name as argument to const inputData = require('./file.json'); from command ...