extern crate walkdir;
extern crate zip;
use std::{fs::File, path::Path};
use zip::ZipWriter;
use crate::BridgeResult;
pub trait OsBridge {
fn get_pid(&self) -> BridgeResult<u32>;
}
pub trait Zip {
fn calculate_size<P>(&self, path: P) -> BridgeResult<f64>
where
P: AsRef<Path>;
fn get_size<P>(&self, path: P) -> u64
where
P: AsRef<Path>;
fn extract<P>(&self, zip_src_path: P, zip_output_path: P) -> BridgeResult<bool>
where
P: AsRef<Path>;
fn file_compression<P>(&self, zip_input_path: P, zip_output_path: P) -> BridgeResult<bool>
where
P: AsRef<Path>;
fn single_folder_compression<P>(
&self,
zip_input_path: P,
zip_output_path: P,
) -> BridgeResult<bool>
where
P: AsRef<Path>;
fn add_dir<P>(
&self,
zip_writer: &mut ZipWriter<File>,
base_dir: P,
current_dir: P,
) -> BridgeResult<bool>
where
P: AsRef<Path>;
fn batch_compression<P>(&self, zip_input_paths: Vec<P>, zip_output_path: P) -> BridgeResult<bool>
where
P: AsRef<Path>;
fn check_folder_is_empty<P>(&self, path: P) -> BridgeResult<bool>
where
P: AsRef<Path>;
fn add_path<P>(&self, zip_writer: &mut ZipWriter<File>, path: P) -> BridgeResult<bool>
where
P: AsRef<Path>;
}