MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / zip_debug_folder

Function zip_debug_folder

src/mz-debug/src/utils.rs:53–74  ·  view source on GitHub ↗

Zips a folder

(zip_file_name: PathBuf, folder_path: &PathBuf)

Source from the content-addressed store, hash-verified

51
52/// Zips a folder
53pub fn zip_debug_folder(zip_file_name: PathBuf, folder_path: &PathBuf) -> std::io::Result<()> {
54 // Delete the zip file if it already exists
55 if zip_file_name.exists() {
56 std::fs::remove_file(&zip_file_name)?;
57 }
58 let zip_file = File::create(&zip_file_name)?;
59 let mut zip_writer = ZipWriter::new(BufWriter::new(zip_file));
60
61 for entry in walkdir::WalkDir::new(folder_path) {
62 let entry = entry?;
63 let path = entry.path();
64
65 if path.is_file() {
66 zip_writer.start_file(path.to_string_lossy(), SimpleFileOptions::default())?;
67 let mut file = File::open(path)?;
68 copy(&mut file, &mut zip_writer)?;
69 }
70 }
71
72 zip_writer.finish()?;
73 Ok(())
74}
75
76pub async fn get_k8s_auth_mode(
77 mz_username: Option<String>,

Callers 1

runFunction · 0.85

Calls 5

copyFunction · 0.85
existsMethod · 0.80
createFunction · 0.50
pathMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected