title: Stream zip file content to the user from website
body: <p>I'm trying to serve a file to the users that is packed inside a zip archive on the server.
  The project is ASP.NET Core 5.0 MVC project.</p>
  <p>I managed to do it by using <code>ZipArchiveEntry.Open()</code> and copying that to a memory stream.</p>
  <pre><code>string zipFile = @&quot;D:\all_installs.zip&quot;;
  
  using (FileStream fs = new FileStream(zipFile, FileMode.Open))
  {
      using (ZipArchive zip = new ZipArchive(fs))
      {
          ZipArchiveEntry entry = zip.Entries.FirstOrDefault(x =&gt; x.FullName == &quot;downloadable file.iso&quot;);
  
          string name = entry.FullName;
          string baseName = Path.GetFileName(name);
  
          //open a stream to the zip entry
          Stream stream = entry.Open();
  
          //copy stream to memory
          MemoryStream memoryStream = new MemoryStream();
          stream.CopyTo(memoryStream); //big memory usage?
          memoryStream.Position = 0;
  
          return this.File(memoryStream, &quot;application/octet-stream&quot;, baseName);
      }
  }
  </code></pre>
  <p>This would require a lot of RAM if there are many simultaneous downloads, so instead I would like to serve it directly from the archive, which I know will require the CPU while unpacking it, but that's fine since the download speed will be very limited anyways.</p>
  <p>I tried serving <code>stream</code> directly, but I get the following error:</p>
  <p><code>NotSupportedException: Stream does not support reading.</code></p>
  <p>How can I serve the entry-stream directly?</p>