#zstd #zstandard

include-bytes-zstd

Includes a file with zstd compression

1 unstable release

0.1.0 Feb 17, 2023

#710 in Compression

Download history 24/week @ 2024-03-13 16/week @ 2024-03-20 54/week @ 2024-03-27 38/week @ 2024-04-03 12/week @ 2024-04-10 31/week @ 2024-04-17 36/week @ 2024-04-24 40/week @ 2024-05-01 29/week @ 2024-05-08 61/week @ 2024-05-15 32/week @ 2024-05-22 18/week @ 2024-05-29 24/week @ 2024-06-05 19/week @ 2024-06-12 31/week @ 2024-06-19 23/week @ 2024-06-26

100 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

~7MB
~137K SLoC