- 添加所需的库到
Cargo.toml
文件中:
zip = "0.6.6"
- 直接上代码, 都在酒里了.
use std::fs::File;
use std::io::{
Read, Write};
use std::process::exit;
use std::path::{
Path, PathBuf};
use zip::ZipArchive;
fn main() {
// ======设置输入输出路径======
let zip_path = Path::new("xxx.gz"