Giter Club home page Giter Club logo

rust-tar's Introduction

rust-tar

A Rust implementation of the tar archive utility.

Should I use this?

Probably not. The tar binary that came with your OS has more features and has been tested against millions of archives, use it instead.

So what's it good for?

Building a tool like this is a really good way to learn Rust syntax+features! Some things I learned:

  1. How to work with raw binary data
  2. How to create iterators over arbitrary data
  3. How to parse+validate CLI parameters using StructOpt
  4. Integration tests using assert_cmd
  5. Rust's built-in unit tests
  6. File I/O
  7. Option and Result types (I love not having to deal with nullable types and exceptions)

How to use

Run with --help to see the list of options:

./rust-tar --help

rust-tar 0.1.1

USAGE:
    rust-tar [FLAGS] <file-name>

FLAGS:
    -x               Extract mode: extract an archive to disk
    -h, --help       Prints help information
    -t               List mode: list archive contents
    -V, --version    Prints version information

ARGS:
    <file-name>    The path to a tarball

Run with -t to show file contents (without saving to disk), or -x to save to disk:

./rust-tar -t test-files/multiple-files.tar

Read all 3072 bytes from tarball successfully 
Processing file header: 'ascii.txt'
  Decimal checksum: 6310
  Calculated checksum: 6310
  File size in bytes: 11
  File contents: Hello, tar!
Processing file header: 'ascii2.txt'
  Decimal checksum: 6354
  Calculated checksum: 6354
  File size in bytes: 17
  File contents: Hello again, tar!

rust-tar's People

Contributors

rgwood avatar

Watchers

 avatar

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.