mirror of
https://github.com/xavo95/repak.git
synced 2025-01-18 19:04:07 +00:00
Add zstd decompression
This commit is contained in:
parent
9974d035b1
commit
08783bff03
3 changed files with 7 additions and 0 deletions
|
@ -18,6 +18,7 @@ ureq = "2.6.2"
|
||||||
hex-literal = "0.4.1"
|
hex-literal = "0.4.1"
|
||||||
hex = { workspace = true }
|
hex = { workspace = true }
|
||||||
once_cell = "1.17.1"
|
once_cell = "1.17.1"
|
||||||
|
zstd = "0.12.3"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
base64 = { workspace = true }
|
base64 = { workspace = true }
|
||||||
|
|
|
@ -362,6 +362,11 @@ impl Entry {
|
||||||
None => buf.write_all(&data)?,
|
None => buf.write_all(&data)?,
|
||||||
Some(Compression::Zlib) => decompress!(flate2::read::ZlibDecoder<&[u8]>),
|
Some(Compression::Zlib) => decompress!(flate2::read::ZlibDecoder<&[u8]>),
|
||||||
Some(Compression::Gzip) => decompress!(flate2::read::GzDecoder<&[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) => {
|
Some(Compression::Oodle) => {
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
return Err(super::Error::Oodle);
|
return Err(super::Error::Oodle);
|
||||||
|
|
|
@ -117,4 +117,5 @@ pub enum Compression {
|
||||||
Zlib,
|
Zlib,
|
||||||
Gzip,
|
Gzip,
|
||||||
Oodle,
|
Oodle,
|
||||||
|
Zstd,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue