title: Write output of ZIO Stream to file
body: <p>I am trying to write the results of a ZIO Stream to a file. The following example app takes a sequence of integers, converts them to bytes, compresses them with the gzip transducer, but I cannot figure out how to write them to a file.</p>
  <p>I think I need to use <code>ZSink.fromOutputStream</code>, but I am unsure how that fits into the code.</p>
  <pre><code>object ZStreamExample extends zio.App {
    val job = (for {
      stream &lt;- ZStream
        .fromIterable(Seq(1,2,3,4))
        .map(value =&gt; s&quot;$value&quot;)
        .map(value =&gt; value.toByte)
        .transduce(gzip())
    } yield stream)
  
    def run(args: List[String]) = {
      job.runCollect
    }.exitCode
  }
  </code></pre>