Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tiaanduplessis/shell-exec
Execute a command through the system shell
https://github.com/tiaanduplessis/shell-exec
exec sh spawn
Last synced: 6 days ago
JSON representation
Execute a command through the system shell
- Host: GitHub
- URL: https://github.com/tiaanduplessis/shell-exec
- Owner: tiaanduplessis
- License: mit
- Created: 2017-06-26T20:14:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-17T23:55:18.000Z (over 2 years ago)
- Last Synced: 2024-04-14T04:50:46.055Z (7 months ago)
- Topics: exec, sh, spawn
- Language: TypeScript
- Size: 274 KB
- Stars: 23
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs - shell-exec - Execute a command through the system shell. (Repository / Shell)
README
# 🐚 shell-exec
[![package version](https://img.shields.io/npm/v/shell-exec.svg?style=flat-square)](https://npmjs.org/package/shell-exec)
[![package downloads](https://img.shields.io/npm/dm/shell-exec.svg?style=flat-square)](https://npmjs.org/package/shell-exec)
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![package license](https://img.shields.io/npm/l/shell-exec.svg?style=flat-square)](https://npmjs.org/package/shell-exec)
[![make a pull request](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)A tiny cross-platform promise based wrapper around child_process.spawn.
## Table of Contents
- [🐚 shell-exec](#-shell-exec)
- [Table of Contents](#table-of-contents)
- [⚙️ Install](#️-install)
- [📖 Usage](#-usage)
- [📚 API](#-api)
- [`shellExec(command, options)`](#shellexeccommand-options)
- [💬 Contributing](#-contributing)
- [🪪 License](#-license)## ⚙️ Install
Install the package locally within you project folder with your package manager:
With `npm`:
```sh
npm install shell-exec
```With `yarn`:
```sh
yarn add shell-exec
```With `pnpm`:
```sh
pnpm add shell-exec
```## 📖 Usage
```ts
import shellExec from 'shell-exec'
shellExec('echo Hi!').then(console.log).catch(console.log)
```## 📚 API
### `shellExec(command, options)`
**Parameters:**
- *`command`* {String | Array} - String or Array of commands to run
- *`options`* {Object} - Options object passed to [`child_process.spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options)The function then returns a `Promise`.
See the hosted docs [here](https://paka.dev/npm/[email protected]/api).
## 💬 Contributing
Got an idea for a new feature? Found a bug? Contributions are welcome! Please [open up an issue](https://github.com/tiaanduplessis/shell-exec/issues) or [make a pull request](https://makeapullrequest.com/).
## 🪪 License
[MIT © Tiaan du Plessis](./LICENSE)