
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
system-commands
Advanced tools
Run system commands in Node.js
npm i system-commands
const system = require('system-commands')
import system = require('system-commands')
Run any command using system(COMMAND). The output is passed into the .then block, and the error (if any) is passed into the .catch block.
/**
* Runs a system command
*
* Parameter `command` - The command you want to run, like `ls` or `mkdir new_directory`
*
* Returns a `Promise` containing the output of the command.
* If the command failed, the error is passed into the `.catch` block.
*/
function system(command: string): Promise<string>
Run the command ls:
// async/await
console.log(await system('ls'))
// Handling errors
system('ls').then(output => {
// Log the output
console.log(output)
}).catch(error => {
// An error occurred! Log the error
console.error(error)
})
// Or for a more concise statement...
system('ls').then(console.log).catch(console.error)
// Output:
/*
* README.md
* lib
* node_modules
* package-lock.json
* package.json
* src
* tests
* tsconfig.json
* tslint.json
* types
*/
Make a new directory:
system('mkdir new_directory').then(() => {
// Directory was created
console.log('Successfully created new_directory')
}).catch(error => {
// Oh no! An error occurred
console.error(error)
})
// Output:
// Successfully created directory
FAQs
Run system commands in Node.js
We found that system-commands demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.