Skip to main content

discover_zstd_dict_blocking

Function discover_zstd_dict_blocking 

Source
pub fn discover_zstd_dict_blocking(
    origin: &str,
    hash: &str,
) -> Result<Vec<u8>, ZstdDictDiscoveryError>
Expand description

Synchronously resolve a zstd dictionary via .well-known/codec/dicts/<hex>.zstd (v0.5+).

Fetches <origin>/.well-known/codec/dicts/<sha256-hex>.zstd, verifies the fetched bytes hash to <hex>, and returns the raw dict bytes ready to feed into zstd::dict::DecoderDictionary::copy(...) or equivalent.

§Example

use codec_rs::discover_zstd_dict_blocking;

let dict = discover_zstd_dict_blocking(
    "https://codec.example",
    "sha256:abc1230000000000000000000000000000000000000000000000000000000000",
)?;

§Errors