title: How decompress and unpack tar.gz archive in download process?
body: <p>I need decompress and unpack big .tar.gz files (e.g. ~5Gb) in download process without save an archive file on disk.
  I use reqwest crate for downloading files, flate2 crate for decompressing and tar crate for unpacking. I try to do it with tar.gz format. But there are the zip and tar.bz2 formats available. (Which one is easier to work with?)
  It seems that I managed to implement this, but unexpectedly unpacking ended with an error:</p>
  <pre><code>thread 'main' panicked at 'Cannot unpack archive: Custom { kind: UnexpectedEof, error: TarError { desc: &quot;failed to unpack `/home/ruut/Projects/GreatWar/launcher/gamedata/gamedata-master/.vscode/settings.json`&quot;, io: Custom { kind: UnexpectedEof, error: TarError { desc: &quot;failed to unpack `gamedata-master/.vscode/settings.json` into `/home/ruut/Projects/GreatWar/launcher/gamedata/gamedata-master/.vscode/settings.json`&quot;, io: Kind(UnexpectedEof) } } } }', /home/ruut/Projects/GreatWar/launcher/src/gitlab.rs:87:38
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  </code></pre>
  <p>My code:</p>
  <pre><code>let full_url = format!(&quot;{}/{}/{}&quot;, HOST, repo_info.url, repo_info.download_url);
  let mut response;
  
  match self.client.get(&amp;full_url).send().await {
    Ok(res) =&gt; response = res,
    Err(error) =&gt; {
      return Err(Error::new(ErrorKind::InvalidData, error));
    }
  };
  
  if response.status() == reqwest::StatusCode::OK {
    let mut stream = response.bytes_stream();
  
    while let Some(item) = stream.next().await {
      let chunk = item
        .or(Err(format!(&quot;Error while downloading file&quot;)))
        .unwrap();
  
      let b: &amp;[u8] = &amp;chunk.to_vec();
      let gz = GzDecoder::new(b);
      let mut archive = Archive::new(gz);
  
      archive.unpack(&quot;./gamedata&quot;).expect(&quot;Cannot unpack archive&quot;);
    }
  }
  </code></pre>
  <p>The <code>archive.unpack</code> throw error after first getting chunk.<br />
  What am I doing wrong?</p>