Enable programmatic use of module

This makes the module export a function that returns a
duplex stream

`if (require.main === module)` then the old semantics of
piping from stdin to itself to stdout are upheld