#zstd #zstandard

include-bytes-zstd

Includes a file with zstd compression

1 unstable release

0.1.0 Feb 17, 2023

#685 in Compression

Download history 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 29/week @ 2024-03-11 14/week @ 2024-03-18 16/week @ 2024-03-25 80/week @ 2024-04-01 7/week @ 2024-04-08 34/week @ 2024-04-15 28/week @ 2024-04-22 43/week @ 2024-04-29

117 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
~135K SLoC