title: C# api octet-stream response body to zip file
body: <p>I have a service which executes a request to a client api that returns a octet-stream response body with the Content-Disposition header in it (This api is meant to return a zip file.). I am using RestSharp and the DownloadData function to get the response as a byte array, but I want to then save the zip file to my local server.</p>
  
  <p>I have tried using DotNetZip and a MemoryStream to create the zip file by using the following example:</p>
  
  <pre><code>using (MemoryStream stream = new MemoryStream(fileBytes))
  {
      using (ZipFile zip = new ZipFile())
      {
         zip.AddEntry("test", stream);
         zip.Save(filePath);
      }
  }
  </code></pre>
  
  <p>The code above creates a zip file and an entry called test but I cannot open it.
  Just to clarify, the zip file I am trying to create contains the following files and folders:</p>
  
  <ul>
  <li>296927a0-5ac7-4ccd-9928-bd74ef7ae68a_20200227074457 (Root folder)
  
  <ul>
  <li>images (folder)
  
  <ul>
  <li>jpg image</li>
  <li>jpg image</li>
  <li>jpg image</li>
  </ul></li>
  <li>details.json (file)</li>
  <li>achievements.json (file)</li>
  <li>evaluation.json (file)</li>
  </ul></li>
  </ul>
  
  <p>Is there any way to achieve this?</p>