use std::fs;
use std::io::prelude::*;
use std::fs::File;
fn main() -> std::io::Result<()> {
let info = infer::Infer::new();
let mut f = File::open("testdata/sample.jpg")?;
let kind = info.get_read(&mut f).unwrap().expect("file type is known");
assert_eq!(kind.mime_type(), "image/jpeg");
assert_eq!(kind.extension(), "jpg");
Ok(())
}
Complementary *_read functions are provided to match existing ones that take a buffer.
Initial work and idea to support Read trait.
Addresses #51.
Example usage:
Complementary
*_read
functions are provided to match existing ones that take a buffer.