Change the api: use an optional object

With defaults to process:
* `stdin`: input stream. Default is `process.stdin`.
* `stdout`: output stream. Default is `process.stdout`.
* `exit`: function which is called when stdin closes. Default is to call `process.exit(0)`.