#zstd #include-bytes-zstd

include-bytes-zstd

Includes a file with zstd compression

1 unstable release

0.1.0 Feb 17, 2023

#50 in #zstd

Download history 62/week @ 2025-01-15 21/week @ 2025-01-22 33/week @ 2025-01-29 47/week @ 2025-02-05 72/week @ 2025-02-12 87/week @ 2025-02-19 86/week @ 2025-02-26 59/week @ 2025-03-05 58/week @ 2025-03-12 63/week @ 2025-03-19 56/week @ 2025-03-26 23/week @ 2025-04-02 40/week @ 2025-04-09 7/week @ 2025-04-16 69/week @ 2025-04-23 57/week @ 2025-04-30

175 downloads per month

MIT/Apache

5KB

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());

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.

Dependencies

~8MB
~160K SLoC