collect the chunks and send to over socket in one message

it would be good if this could be made to stream from forEach but it
seems that forEach doesn't accept backpressure.