Skip to content

almielczarek/zip-dir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zip-dir

crates.io Docs

Usage

[dependencies]
zip-dir = "0.1"

This crate provides the zip_dir function which can be used as follows:

use std::fs::File;
use std::io;
use std::path::Path;

use zip_dir::zip_dir;

fn run() -> io::Result<()> {
    let path = Path::new(".");
    let file = File::create("archive.zip")?;

    // See http://mvdnes.github.io/rust-docs/zip-rs/zip/write/struct.FileOptions.html for options
    // Passing None uses the default options with no compression
    let options = None;

    // zip_dir returns its second parameter wrapped in a Result if successful
    let _file = zip_dir(path, file, options)?;

    Ok(())
}

fn main() {
    match run() {
        Ok(()) => println!("Wrote archive.zip"),
        Err(e) => eprintln!("Error: {}", e)
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages