Skip to content

A simple way to execute shell commands in Node

Notifications You must be signed in to change notification settings

sagarthomas/cmdin

Repository files navigation

cmdin

Build Status Coverage Status npm version

About

Cmdin is a simple wrapper over the node child_process.exec() utilizing ES6 Promises to execute shell commands.

Install

npm install cmdin --save

Usage

The most simplest usage is as follows:

const cmd = require('cmdin');

cmd.run('ls').then((res) => {
    console.log(res.stdout); 
}).catch(e => {
    console.log(e);
});

Arguments

Arguments can be written inline:

cmd.run('ls -a -l').then((res) => {
    console.log(res.stdout); 
}).catch(e => {
    console.log(e);
});

or passed as an array structure:

cmd.run('ls',['-l', '-a']).then((res) => {
    console.log(res.stdout); 
}).catch(e => {
    console.log(e);
});

About

A simple way to execute shell commands in Node

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published