Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

running shell commands javascript

const execSync = require('child_process').execSync;
// import { execSync } from 'child_process';  // replace ^ if using ES modules

const output = execSync('ls', { encoding: 'utf-8' });  // the default is 'buffer'
console.log('Output was:
', output);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #running #shell #commands #javascript
ADD COMMENT
Topic
Name
5+6 =