rust-lang / flate2-rs

DEFLATE, gzip, and zlib bindings for Rust

Home Page:https://docs.rs/flate2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

basic tar encode + decode failure

verrchu opened this issue · comments

I am sure I am doing something wrong but I don't know what exactly

the code on the playground works fine untill you substittue reader and writer to the commented ones which use Gz{En,De}coder
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=59fafd2fdf1dc39e6f71908cba87b070

deps:
tar = 3.3.0
flate2 = 1.0.25
tar = 0.4.38

ok now this works
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b193c20f3ccb6b6b628d165d394da174

apparently dropping builder ofter writing an archive solves the problem

The GzEncoder works similarly to the tar::Builder. You need to call its finish method when all content has been written. Dropping the GzEncoder does this, but you can get the same effect using builder.into_inner()?.finish()?;

Closing in favor of the above comment, thanks!