1extern crate walkdir;
2extern crate zip;
3
4use std::{fs::File, path::Path};
5use zip::ZipWriter;
6
7use crate::BridgeResult;
8
9pub trait OsBridge {
11 fn get_pid(&self) -> BridgeResult<u32>;
12}
13
14pub trait Zip {
16 fn calculate_size<P>(&self, path: P) -> BridgeResult<f64>
18 where
19 P: AsRef<Path>;
20
21 fn get_size<P>(&self, path: P) -> u64
23 where
24 P: AsRef<Path>;
25
26 fn extract<P>(&self, zip_src_path: P, zip_output_path: P) -> BridgeResult<bool>
30 where
31 P: AsRef<Path>;
32
33 fn file_compression<P>(&self, zip_input_path: P, zip_output_path: P) -> BridgeResult<bool>
37 where
38 P: AsRef<Path>;
39
40 fn single_folder_compression<P>(
44 &self,
45 zip_input_path: P,
46 zip_output_path: P,
47 ) -> BridgeResult<bool>
48 where
49 P: AsRef<Path>;
50
51 fn add_dir<P>(
56 &self,
57 zip_writer: &mut ZipWriter<File>,
58 base_dir: P,
59 current_dir: P,
60 ) -> BridgeResult<bool>
61 where
62 P: AsRef<Path>;
63
64 fn batch_compression<P>(&self, zip_input_paths: Vec<P>, zip_output_path: P) -> BridgeResult<bool>
69 where
70 P: AsRef<Path>;
71
72 fn check_folder_is_empty<P>(&self, path: P) -> BridgeResult<bool>
75 where
76 P: AsRef<Path>;
77
78 fn add_path<P>(&self, zip_writer: &mut ZipWriter<File>, path: P) -> BridgeResult<bool>
82 where
83 P: AsRef<Path>;
84}