perintah bash di node

const { exec } = require('child_process');
exec('ls | grep js', (err, stdout, stderr) => {  
  if (err) {    
    //some err occurred    
    console.error(err)  
  } else {   
    // the *entire* stdout and stderr (buffered)   
    console.log(`stdout: ${stdout}`);   
    console.log(`stderr: ${stderr}`);  
  }
});
Sleepy Snail