
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.
@softeq/utils
Advanced tools
Implementation of helper tools.
Development documentation
npm install @softeq/utils
Package helper tools are responsible on helpers to simplify interaction with server commands. Node.js has child_process module that provides the ability to spawn child processes in a manner that is similar, but not identical, to popen(3)
Default child_process.exec callback has a bit non standard arguments order to have more stable common handlers callback approach. Default handler callback:
/**
* @param {Error} error - Instance of Error object. Can be thrown when runtime errors occur.
* @param {string | Buffer} stdout - `stdout` unix output string
* @param {string | Buffer} stderr - `stderr` unix output string
*/
function callback(error, stdout, stderr) {
// ...
}
exec('ps', (error, stdout, stderr) => {
// ...
})
Helper function execAction provides more standard arguments order and provides internal errors handlers according to conditional configuration exitConditions.
/**
* @param {string | Buffer} response - `stdout` unix output string
* @param {string | Buffer} stderr - `stderr` unix output string
* @param {Error} error - Instance of Error object. Can be thrown when runtime errors occur.
*/
function callback(response, stderr, error) {
// ...
}
exec('ps', execAction((response, stderr, error) => {
// ...
}, { stderr: true, error: false }));
Helper function stop stops any running process and displays message according to the Logger.stack method.
exec('ps', execAction(() => {
stop([`${ANSI_FG_RED}%s${ANSI_FG_NC}`, `The machine will not be reboot according to the \`stop\` command.`]);
exec('sudo shutdown -r now', execAction(() => {
Logger.stack([
[`${ANSI_FG_RED}%s${ANSI_FG_NC}`, `The machine has been reboot.`],
]);
}))
}));
Pay attention to the argument of stop function:
Colors:
Note: try to consider why do we need no color ANSI escape code.
Node.js interaction with server requires terminal notifications often. Logger class provides the common way to compose notifications with next static methods.
static Logger.stackDisplays the stack of messages. Message is an array of console.log arguments.
Logger.stack([
[`%s`, `${ANSI_FG_GREEN}Response:${ANSI_FG_NC}`],
[response],
]);
static Logger.errorDisplays an error according to unix output standard with Node.js improvement according to conditional configuration exitConditions.
Logger.error(error, stderr, { stderr: true, error: false });
EMPTY_LINE as a new line or EMPTY_STRING.FAQs
Javascript Utils
The npm package @softeq/utils receives a total of 0 weekly downloads. As such, @softeq/utils popularity was classified as not popular.
We found that @softeq/utils 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.