# path-with-zip Ex version of PathBuf in Rust. Examples below assume that there is a 'test.zip' in the same directory of this executable program file. (Root of 'test.zip') |---test(Folder) |---test.txt(File) ## Example: Reading a file in a zip archive ```rust use path_with_zip::PathBufWithZip; let path = "test.zip///test/test.txt"; // The error type is zip::result::ZipError, which includes std::io::Error. let bytes: Vec = PathBufWithZip::from(path).read_bytes_directly().unwrap(); ``` Another way: ```rust use path_with_zip::PathBufWithZip; let path = "test.zip///test/test.txt"; let pathbuf_with_zip = PathBufWithZip::from(path); let mut zip_archive = pathbuf_with_zip.open_archive().unwrap(); // OR // let mut zip_archive = pathbuf_with_zip.open_archive_into_memory().unwrap(); let bytes: Vec = pathbuf_with_zip.read_bytes(Some(&mut zip_archive)).unwrap(); ``` ## Example: Reading a file like using PathBuf ```rust use path_with_zip::PathBufWithZip; let path = "test.zip"; let bytes: Vec = PathBufWithZip::from(path).read_bytes_directly().unwrap(); ``` Another way: ```rust use path_with_zip::PathBufWithZip; let path = "test.zip"; let pathbuf_with_zip = PathBufWithZip::from(path); let bytes: Vec = pathbuf_with_zip.read_bytes(None).unwrap(); ```