A
A
Alexander Knyazev2016-03-25 12:57:29
JavaScript
Alexander Knyazev, 2016-03-25 12:57:29

How to access a parameter passed to a child script?

There is an index.js script that runs a child phantom-script.js script:

var childProcess = require('child_process');
var ffmpeg = require('fluent-ffmpeg');
var phantomjs = require('phantomjs-prebuilt');
var binPath = phantomjs.path;

var parametr = 'my';
//передаем параметр 
var childArgs = [
  path.join(__dirname, 'phantom-script.js'), parametr
]

childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) {
  generate_video();
})

I can’t find anywhere how to access the passed parameter in the child script now

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alex, 2016-03-25
@ObsSpace

exports & require

K
Konstantin Kitmanov, 2016-03-25
@k12th

process.argv . If not enough, then there is minimist .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question