# tiny-proc

> Set handlers for a spawned process, await result.

Latest version **3.0.0** (published 2019-01-13) · 0 weekly downloads

## Install

```sh
npm install tiny-proc
pnpm add tiny-proc
yarn add tiny-proc
bun add tiny-proc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2019-01-13 |
| First published | 2019-01-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | grabantot |
| Keywords | spawn, promise, stdout, stdin, stderr, process, child_process, await |

## Links

- npm: https://www.npmjs.com/package/tiny-proc
- Repository: https://github.com/grabantot/tiny-cmd
- Homepage: https://github.com/grabantot/tiny-cmd#readme
- Issues: https://github.com/grabantot/tiny-cmd/issues
- npm.io page: https://npm.io/package/tiny-proc

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^4.1.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2019-01-13

## README

# tiny-proc
Set handlers for a spawned process, await result.

## Usage
Simple example, concat stdout:
```
const tinyProc = require('tiny-proc')

const cmd = 'echo -n hello && echo -n 123' // -n option - don't add new line
const proc = tinyProc.create(cmd)
proc.run('')
proc.on('stdout', data => {
  proc.result += data
})
const res = await proc.awaitExit()

console.log('result:', res) // prints 'result: hello123'
```

run with DEBUG=tiny-proc:* to see all logs

## proc methods
- run(initialResult, expectedExitCode=0)
- write(chunk)
- end(chunk)
- awaitExit()

## fields
- spawnOptions
- spawned
- isClosed
- exitCode
- result

## events
- close
- error
- stdout
- stderr
- stdin

---
_Source: https://npm.io/package/tiny-proc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
