Skip to main content

detect_source

Function detect_source 

Source
pub fn detect_source<S: RangedSource, C: Cancellation>(
    source: &mut S,
    limits: &Limits,
    cancellation: &C,
) -> Result<Option<Detection>>
Expand description

Read the leading bytes of source and recognize its input family as detect_format does, also locating a displaced PDF header.

Only min(SIGNATURE_BYTES, size) bytes are read when a signature starts at byte 0; otherwise CAA fields and a displaced PDF header are searched in at most PDF_HEADER_SEARCH_BYTES in total, in reads no larger than limits.io_chunk_bytes. Ok(None) means unrecognized.