shell-exec
Version:
A tiny cross-platform promise based wrapper around child_process.spawn.
69 lines (46 loc) • 2.14 kB
Markdown
# 🐚 shell-exec
[](https://npmjs.org/package/shell-exec)
[](https://npmjs.org/package/shell-exec)
[](https://github.com/RichardLitt/standard-readme)
[](https://npmjs.org/package/shell-exec)
[](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/shell-exec@1.1.0/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)