# Path With Zip **Repository Path**: brightmeows/path-with-zip ## Basic Information - **Project Name**: Path With Zip - **Description**: path with zip - **Primary Language**: Rust - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-01-30 - **Last Updated**: 2026-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 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(); ```