Add streaming interface

Fixes #5.