diff --git a/repak/Cargo.toml b/repak/Cargo.toml index f4c2cf6..532a01e 100644 --- a/repak/Cargo.toml +++ b/repak/Cargo.toml @@ -18,6 +18,7 @@ ureq = "2.6.2" hex-literal = "0.4.1" hex = { workspace = true } once_cell = "1.17.1" +zstd = "0.12.3" [dev-dependencies] base64 = { workspace = true } diff --git a/repak/src/entry.rs b/repak/src/entry.rs index c2f45df..df1a8fc 100644 --- a/repak/src/entry.rs +++ b/repak/src/entry.rs @@ -362,6 +362,11 @@ impl Entry { None => buf.write_all(&data)?, Some(Compression::Zlib) => decompress!(flate2::read::ZlibDecoder<&[u8]>), Some(Compression::Gzip) => decompress!(flate2::read::GzDecoder<&[u8]>), + Some(Compression::Zstd) => { + for range in ranges { + io::copy(&mut zstd::stream::read::Decoder::new(&data[range])?, buf)?; + } + } Some(Compression::Oodle) => { #[cfg(not(target_os = "windows"))] return Err(super::Error::Oodle); diff --git a/repak/src/lib.rs b/repak/src/lib.rs index bfb4208..5b64447 100644 --- a/repak/src/lib.rs +++ b/repak/src/lib.rs @@ -117,4 +117,5 @@ pub enum Compression { Zlib, Gzip, Oodle, + Zstd, }