Constant fif::files::INITIAL_BUF_SIZE

source ·
pub const INITIAL_BUF_SIZE: usize = 128;
Expand description

The number of bytes to read initially when identifying a file’s MIME type. Used in the mime_type function.

Rather than reading the entire file all at once into a BUF_SIZE buffer, it tends to be faster to read a small chunk of the file and trying to identify that, proceeding with the larger buffer if that fails. Many file formats can be identified with the first few dozen bytes, so the “happy path” will likely be taken in the majority of cases.