fn extract_strand(zipfile: &str) -> Result<()> {
    let mut zip = zip::ZipArchive::new(File::open(zipfile)?)?;

    let mut buffer = vec![0; EXTRACT_BUFFER_SIZE];

    for i in 0..zip.len() {
        let mut file = zip.by_index(i).unwrap();
        if file.name().ends_with(".strand") {
            let mut target = File::create(file.name())?;
            while let Ok(size) = file.read(&mut buffer) {
                if size == 0 {
                    break;
                }
                target.write_all(&buffer[0..size])?;
            }
            break;
        }
    }

    Ok(())
}
// Extracts a strand file from the given ZIP archive
// and dumps it to the current working directory by
// its original name
Extracts a strand file from the given ZIP archive
and dumps it to the current working directory by
its original name
Extracts a strand file from the given ZIP archive and dumps it to the current working directory by its original name
fn extract_strand(zipfile: &str) -> Result<()> {
    let mut zip = zip::ZipArchive::new(File::open(zipfile)?)?;
    let mut buffer = vec![0; EXTRACT_BUFFER_SIZE];
    for i in 0..zip.len() {
        let mut file = zip.by_index(i).unwrap();
        if file.name().ends_with(".strand") {
            let mut target = File::create(file.name())?;
            while let Ok(size) = file.read(&mut buffer) {
                if size == 0 {
                    break;
                }
                target.write_all(&buffer[0..size])?;
            }
            break;
        }
    }
    Ok(())
}
fn extract_strand ( zipfile : & str ) -> Result < ( ) > { let mut zip = zip :: ZipArchive :: new ( File :: open ( zipfile ) ? ) ? ; let mut buffer = vec ! [ 0 EXTRACT_BUFFER_SIZE ] ; for i in 0 .. zip . len ( ) { let mut file = zip . by_index ( i ) . unwrap ( ) ; if file . name ( ) . ends_with ( " " ) { let mut target = File :: create ( file . name ( ) ) ? ; while let Ok ( size ) = file . read ( & mut buffer ) { if size == 0 { break ; } target . write_all ( & buffer [ 0 .. size ] ) ? ; } break ; } } Ok ( ( ) ) }
Extracts a strand file from the given ZIP archive
and dumps it to the current working directory by
its original name
Extracts a strand file from the given ZIP archive and dumps it to the current working directory by its original name
zipfile
&str