This can be done directly with Node, you can use the child_process module. Please note that this is asynchronous.
const exec = require('child_process').exec; function execute(command, callback) { exec(command, (error, stdout, stderr) => { callback(stdout); }); }; // call the function execute('ping -c 4 0.0.0.0', (output) => { console.log(output); });
I also urge you to take a look at npm , there are many modules here that can help you do what you want without calling a Python script.
source share