Code Monkey home page Code Monkey logo

archiver-rs's People

Contributors

kinosang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

faokunega gz meuter

archiver-rs's Issues

Add suport for async Rust

Most underlying crate you're using in this project are already compatible with async Rust. Please consider adding extensions to this crate that would made it more suitable to use in async contexts.

tar.xz produces "InvalidData" error

I'm trying to extract a tar.xz file and I get an InvalidData io error.

The relevant pattern for .tar.xz seems to be missing in lib.rs:

match buffer {
        #[cfg(all(feature = "bzip", feature = "tar"))]
        [0x42, 0x5A] => Ok(Box::new(Tar::new(Bzip2::new(file)?)?)), // .tar.gz
        #[cfg(all(feature = "gzip", feature = "tar"))]
        [0x1F, 0x8B] => Ok(Box::new(Tar::new(Gzip::new(file)?)?)), // .tar.gz
        #[cfg(feature = "zip")]
        [0x50, 0x4B] => Ok(Box::new(Zip::new(file)?)), // .zip
        _ => Err(Error::from(ErrorKind::InvalidData))?,
    }

When I run the following code I:

    let path = Path::new("my.tar.xz");
    let mut file = File::open(&path)?;
    let mut buffer = [0u8; 2];
    file.read(&mut buffer)?;
    file.seek(SeekFrom::Start(0))?;
    for b in buffer.iter() {
        println!("{:x}", b);
    }

I get 0xfd and 0x37 as the first two bytes so would suggest the following addition:

        #[cfg(all(feature = "xz", feature = "tar"))]
        [0xFD, 0x37] => Ok(Box::new(Tar::new(Xz::new(file)?)?)), // .tar.xz

Thank you for this great crate!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.