#zstd #zstandard

include-bytes-zstd

Includes a file with zstd compression

1 unstable release

0.1.0 Feb 17, 2023

#6 in #zstandard

Download history 8/week @ 2024-07-22 51/week @ 2024-07-29 28/week @ 2024-08-05 31/week @ 2024-08-12 65/week @ 2024-08-19 26/week @ 2024-08-26 166/week @ 2024-09-02 25/week @ 2024-09-09 12/week @ 2024-09-16 31/week @ 2024-09-23 51/week @ 2024-09-30 17/week @ 2024-10-07 13/week @ 2024-10-14 20/week @ 2024-10-21 56/week @ 2024-10-28 24/week @ 2024-11-04

115 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

~7.5MB
~143K SLoC