[][src]Function misc_utils::fs::file_open_read_with_capacity

pub fn file_open_read_with_capacity<P>(
    file: P,
    buffer_capacity: usize
) -> Result<Box<dyn Read>, Error> where
    P: AsRef<Path>, 

Create reader for uncompressed or compressed files transparently.

This function opens the given file and tries to determine the filetype by reading the magic bytes from the start of the file. If a known archive type, like xz, gz, or bz2, is found this function will transparent create a reader which decompresses the data on the fly.

File I/O will always be buffered using a BufReader. The buffer_capacity argument specifies the capacity of the BufReader in bytes.