Skip to main content

document_limit

Function document_limit 

Source
pub fn document_limit(
    source: &ProviderSource,
    head: &[u8],
) -> Option<(usize, &'static str)>
Expand description

The most bytes a provider reads of a source’s own file, for the formats it reads whole: a dotLottie package (MAX_PROVIDER_DOCUMENT_BYTES), a Lottie JSON file (MAX_LOTTIE_DOCUMENT_BYTES), and an SVG document (MAX_SVG_DOCUMENT_BYTES), with what the file is called; None for the formats a provider decodes as it goes. head is the file’s start: a Lottie source’s file is a package when it starts as a ZIP file does.

A host checks a file’s size against it before reading it, and every provider checks the bytes it is given before parsing them.