write to stream instead of reading from files