Gathering detailed insights and metrics for node-command-line
Gathering detailed insights and metrics for node-command-line
Gathering detailed insights and metrics for node-command-line
Gathering detailed insights and metrics for node-command-line
Simple command line interface to execute command from node environment with promise
npm install node-command-line
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
24 Commits
2 Watchers
2 Branches
1 Contributors
Updated on Aug 09, 2023
Latest Version
2.0.2
Package Id
node-command-line@2.0.2
Unpacked Size
9.77 kB
Size
2.83 kB
File Count
5
NPM Version
9.8.1
Node Version
16.15.1
Published on
Aug 10, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
Simple node.js commandline or terminal interface to execute cli commands from node environment with/without promise
using node-command-line you can run commands synchronously/asynchronously and get the output as a promise.
$ npm install --save node-command-line
method | argument | functionality |
---|---|---|
run | command, true/false | run command synchronously/asynchronously based on using await and pass second parameter true or false to print from library or not. Default vaue is true. |
I've added a basic sanitization step that removes characters commonly associated with shell command injection attacks. This helps prevent unwanted characters from being executed within the shell command.
Inject the dependencies
var cmd = require('node-command-line')
Ex1: Execute the single command without wait
function runSingleCommandWithoutWait() {
cmd.run('node --version');
console.log('Executed your command :)');
}
In this example run the command node --version
that will show the node version and also print Executed your command :)
.
node version may shown after print Executed your command :)
because of second command do not wait for executing the first command.
I've added a basic sanitization step that removes characters commonly associated with shell command injection attacks. This helps prevent unwanted characters from being executed within the shell command.
Output in console like:
Executed your command :)
v16.15.1
Ex2: Execute command and pass second parameter true/false to print from library or not
function runSingleCommandWithoutWait() {
cmd.run('node --version', false); // Will not print output from library
console.log('Executed your command :)');
}
In this example run the command node --version
that will not sow the node version but print Executed your command :)
.
node version won't show after print Executed your command :)
because the second parameter passed false.
Output in console like:
Executed your command :)
Ex3: Execute the single command with wait (using promise)
async function runSingleCommandWithWait() {
await cmd.run('node --version');
console.log('Executed your command :)');
}
In this example run the command node --version
that will show the node version and also print Executed your command :)
.
node version will show before print Executed your command :)
because of second command will execute after executing the first command.
Output in console like:
v16.15.1
Executed your command :)
Ex4: Execute the multiple command without wait
async function runMultipleCommandWithoutWait() {
var commands = ["node --version", "npm --version"];
for (var i = 0; i < commands.length; i++) {
cmd.run(commands[i]);
}
console.log('Executed your command :)');
}
In this example run the command node --version
and npm --version
that will show the node version and npm version also print Executed your command :)
.
node and npm version may shown after print Executed your command :)
because of `console.log`` do not wait for executing the first two command.
Output in console like:
Executed your command :)
v16.15.1
9.8.1
Ex5: Execute the multiple command without wait
async function runMultipleCommandWithWait() {
var commands = ["node --version", "npm --version"];
for (var i = 0; i < commands.length; i++) {
await cmd.run(commands[i]);
}
console.log('Executed your command :)');
}
In this example run the command node --version
and npm --version
that will show the node version and npm version also print Executed your command :)
.
node and npm version will show before print Executed your command :)
because of `console.log`` will be waiting for executing the first two command.
Output in console like:
v16.15.1
9.8.1
Executed your command :)
Ex6: Execute the single command with async wait and get response
async function runSingleCommandWithWaitAndGetResponse() {
let response = await cmd.run('node --version');
if(response.success) {
console.log('Response received===', response.message);
// do something
// if success get stdout info in message. like response.message
} else {
// do something
// if not success get error message and stdErr info as error and stdErr.
//like response.error and response.stdErr
}
console.log('Executed your command :)');
}
Output in console like:
Executed your command :)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More