Write to a stream, respecting backpressure