decom
Rust crate for decompressing streams with an automatically-selected codec.
Compressing data is out of scope.
use Read;
use Decompressor;
// anything readable; a file, an HTTP response etc.
let compressed = new;
// LZ4 compression is detected from the first few bytes
if let Ok = try_new ;
Codec support
| codec | feature | notes |
|---|---|---|
| GZip | gzip |
flate2 crate with zlib-rs backend |
| LZ4 | lz4 |
lz4_flex crate |
| ZLib | zlib |
flate2 crate with zlib-rs backend |
| Zstd | zstd |
zstd crate |
Wishlist
Codecs' compressed byte streams must be self-identifying (i.e. start with "magic bytes").
- BZip2
- XZip
- Snappy
- LZMA
Adding new codecs
- If necessary, add a dependency to handle decoding, under a new feature
pub usethe dependency inlib.rs
- Include the new codec in
decom::Formatand itsTryFrom<&[u8; 4]>implementation - Update
decom::io::Decompressorto return a valid reader - Unit test it
- Use the new codec to compress
data/lorem.txt, with an appropriate file extension - Add this file to the
test_utilsmodule - Add it to the response of
supported_unsupported - Add any individual unit tests you need
- Use the new codec to compress
- Document the change in
README.md