Support piping to a writable stream

Fixes #2