fn zip(_name: &str, _list: Vec<&str>) -> zip::result::ZipResult<()>
{
let path = std::path::Path::new(_name);
let file = std::fs::File::create(&path).unwrap();
let mut zip = zip::ZipWriter::new(file);
for i in _list.iter() {
zip.start_file(i as &str, FileOptions::default())?;
}
zip.finish()?;
Ok(())
}
buf := new(bytes.Buffer)
w := zip.NewWriter(buf)
for _, filename := range list {
input, err := os.Open(filename)
if err != nil {
return err
}
output, err := w.Create(filename)
if err != nil {
return err
}
_, err = io.Copy(output, input)
if err != nil {
return err
}
}
err := w.Close()
if err != nil {
return err
}
err = os.WriteFile(name, buf.Bytes(), 0777)
if err != nil {
return err
}