Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pawelgalazka/shell

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pawelgalazka/shell

Simple exec of shell commands

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.6K
decreased by-15.44%
Maintainers
1
Weekly downloads
 
Created
Source

shell node version Build Status npm version

Simple exec of shell commands in node

const { shell } = require('@pawelgalazka/shell')

shell('touch somefile.js')
shell('http-server', { async: true })

shell(cmd, options)

Options:

{
    cwd: ..., // current working directory (String)
    async: ... // run command asynchronously (true/false), false by default
    env: ... // environment key-value pairs (Object)
    timeout: ...
    transform: // function which transforms the output, line by line
    nopipe: // if true, it will send output directly to parent process
    silent: // if true, it won't print anything to the terminal
}
interface IShellOptions {
  cwd?: string
  env?: NodeJS.ProcessEnv
  timeout?: number
  async?: boolean
  nopipe?: boolean
  silent?: boolean
  transform?: (output: string) => string
}

prefixTransform(prefix)

Transform function which can be used for transform option.

Example:

const { shell, prefixTransform } = require('@pawelgalazka/shell')

shell('echo "test"', { transform: prefixTransform('[prefix]') })
$ node ./script.js
echo "test"
[prefix] test

Keywords

FAQs

Package last updated on 24 Apr 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc