#zstd #zstandard

include-bytes-zstd

Includes a file with zstd compression

1 unstable release

0.1.0 Feb 17, 2023

#621 in Compression

Download history 1/week @ 2023-11-20 91/week @ 2023-11-27 34/week @ 2023-12-04 2/week @ 2023-12-11 15/week @ 2023-12-18 4/week @ 2024-01-15 51/week @ 2024-01-22 5/week @ 2024-02-05 110/week @ 2024-02-12 37/week @ 2024-02-19 51/week @ 2024-02-26 33/week @ 2024-03-04

232 downloads per month

MIT/Apache

5KB

include_bytes_zstd!()

This library provides a macro to include a file with zstd compression.

This macro can be used like std::include_bytes!, but the byte array is compressed by the zstd crate. The included data will be decompressed by the ruzstd crate in runtime and returned as a Vec<u8>.

This macro performs the decompression each time it is called.

Examples

input.txt:

This is a test.

Rust code:

let data = include_bytes_zstd::include_bytes_zstd!("test-resources/input.txt", 19);
assert_eq!(b"This is a test.\n", data.as_slice());

License

Licensed under either of

at your option.

Contribution

See the guidelines.


lib.rs:

Includes a file with zstd compression.

This macro can be used like std::include_bytes, but the byte array is compressed by the zstd crate. The included data will be decompressed by the ruzstd crate in runtime and returned as a Vec<u8>.

This macro performs the decompression each time it is called.

Examples

input.txt:

This is a test.

Rust code:

let data = include_bytes_zstd::include_bytes_zstd!("test-resources/input.txt", 19);
assert_eq!(b"This is a test.\n", data.as_slice());

Dependencies

~6.5MB
~119K SLoC