Skip to main content

open_input_opt_progress

Function open_input_opt_progress 

Source
pub fn open_input_opt_progress(
    path: &Path,
    progress_fn: Option<Box<dyn Fn(u64)>>,
) -> Result<Box<dyn Read>>
Expand description

Open path as a streaming byte source, transparently handling any supported compression format — including zip archives, which need a different opening strategy than the stream decoders (see crate::zip_input). This is the entry point call sites should use instead of manually pairing File::open with Compression::wrap_reader.

When progress_fn is Some, it receives cumulative bytes read from disk (raw/compressed bytes, for compressed/zip inputs) as they’re read; size a progress bar over this with input_progress_len. The zero- and always-progress conveniences open_input / open_input_with_progress are thin wrappers over this.