Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

execute shell command from html button node js

const { exec } = require('child_process');
exec('ls -lart', (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
  console.log(`stdout: ${stdout}`);
  console.error(`stderr: ${stderr}`);
});
 
PREVIOUS NEXT
Tagged: #execute #shell #command #html #button #node #js
ADD COMMENT
Topic
Name
5+7 =