npm.io
2.1.6 • Published 6 years ago

@tulpep/leopardcreek-cross

Licence
MIT
Version
2.1.6
Deps
10
Size
22 kB
Vulns
1
Weekly
0

LeopardCreek Cross

Module cross utils.

Supported Operating Systems

  • Windows
  • Linux

How to Install it

npm i @tulpep/leopardcreek-cross

Available Methods:

spawnCommand()

Allows you to run commands on the consoles of operating systems.

Parameters

function commandExecutor.spawnCommand(command, desiredTimeout, desiredMaxLength, parseResult = false)

command: hostname // command syntax
desiredTimeout: "" // optional Timeout, specify the maximum return time of the command
desiredMaxLength: "" // optional MaxLength, specify the size of the command return. 

Example return for Windows

    {   
        output: 'Tulpep-Comp',
        error: '',
        exitCode: 0,
        message: 'Tulpep-Comp' 
    }

Example return for Linux

    {   
        output: 'Lnx-Comp',
        error: '',
        exitCode: 0,
        message: 'Lnx-Comp' 
    }

function osUtils.isWindows() function osUtils.isLinux()

Example return for Windows

    True or False

Example return for Linux

    True or False

How To Use it:

const exec = require('./index.js').configurations;

async function testCommandExecutor() {
  console.log(exec.osUtils.isWindows());
  return new Promise((resolve) => {
    exec.commandExecutor.spawnCommand('hostname')
      .then(async (response) => {
        console.log(response);
        resolve(response);
      });
  });
}

const command = testCommandExecutor();

console.log(command);

Dependencies