Skip to content

Commit

Permalink
Add API docs (fixes #50)
Browse files Browse the repository at this point in the history
  • Loading branch information
timdp committed Feb 14, 2017
1 parent 740f8a0 commit 6b4f764
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,35 @@ spawn(command, args, options)
})
```

## API

```js
async spawn(command[, args][, options])
```

The returned `Promise` will resolve to the process's standard output. Depending
on the value of the `encoding` option (see below), it will either be a
[`Buffer`](https://nodejs.org/api/buffer.html) or a string.

The promise also exposes the created child process via its `childProcess`
property.

Upon rejection, the following properties provide additional information on the
`Error` object:

- `exitSignal`
- `exitStatus`
- `stdout`
- `stderr`

## Options

All options are passed on to
[cross-spawn](https://www.npmjs.com/package/cross-spawn), with the exception of
the additional `encoding` option. If you pass a string (e.g., `'utf8'`), it will
be used as the
[default character encoding](https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding).

## Maintainer

[Tim De Pauw](https://github.com/timdp)
Expand Down

0 comments on commit 6b4f764

Please sign in to comment.