#gzip #deflate

compressible

Check if a content-type can be compressed using gzip, deflate, brotli, etc

2 unstable releases

0.2.0 Jul 3, 2021
0.1.0 Jun 7, 2021

#42 in #deflate

MIT license

32KB
635 lines

compressible

Check if a content type is compressible using compression algorithms like gzip, brotli, deflate, etc.

Usage

Cargo.toml

[dependencies]
compressible = "0.2.0"

main.rs

use compression::is_compressible;

assert_eq!(is_compressible("text/plain"), true);
assert_eq!(is_compressible("image/jpeg"), false);

lib.rs:

Compressible

Compressible checks if a provided media type is compressible using compression algorithms like brotli, gzip, deflate, etc.

Dataset from https://github.com/jshttp/mime-db/blob/fa5e4ef3cc8907ec3c5ec5b85af0c63d7059a5cd/db.json

use compressible::is_compressible;

assert_eq!(is_compressible("text/plain"), true);

Dependencies

~37KB