Coder Social home page Coder Social logo

gophersgang / archiver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mholt/archiver

0.0 2.0 0.0 69 KB

Easily create and extract .zip, .tar, .tar.gz, .tar.bz2, .tar.xz, .tar.lz4, .tar.sz, and .rar (extract-only) files with Go

License: MIT License

Go 96.73% Shell 3.27%

archiver's Introduction

archiver archiver GoDoc Linux Build Status Windows Build Status

Package archiver makes it trivially easy to make and extract common archive formats such as .zip, and .tar.gz. Simply name the input and output file(s).

Files are put into the root of the archive; directories are recursively added, preserving structure.

The archiver command runs the same cross-platform and has no external dependencies (not even libc); powered by the Go standard library, dsnet/compress, nwaples/rardecode, and ulikunitz/xz. Enjoy!

Supported formats/extensions:

  • .zip
  • .tar
  • .tar.gz & .tgz
  • .tar.bz2 & .tbz2
  • .tar.xz & .txz
  • .tar.lz4 & .tlz4
  • .tar.sz & .tsz
  • .rar (open only)

Install

go get github.com/mholt/archiver/cmd/archiver

Or download binaries from the releases page.

Command Use

Make a new archive:

$ archiver make [archive name] [input files...]

(At least one input file is required.)

To extract an archive:

$ archiver open [archive name] [destination]

(The destination path is optional; default is current directory.)

The archive name must end with a supported file extension—this is how it knows what kind of archive to make. Run archiver -h for more help.

Library Use

import "github.com/mholt/archiver"

Create a .zip file:

err := archiver.Zip.Make("output.zip", []string{"file.txt", "folder"})

Extract a .zip file:

err := archiver.Zip.Open("input.zip", "output_folder")

Working with other file formats is exactly the same, but with their own Archiver implementations.

FAQ

Can I list a file in one folder to go into a different folder in the archive?

No. This works just like your OS would make an archive in the file explorer: organize your input files to mirror the structure you want in the archive.

Can it add files to an existing archive?

Nope. This is a simple tool; it just makes new archives or extracts existing ones.

archiver's People

Contributors

dmitshur avatar dsnet avatar jabgibson avatar mholt avatar petemoore avatar railsmechanic avatar shenjh369 avatar songmu avatar tatsushid avatar thomasdotcodes avatar tw4452852 avatar valpackett avatar whatalnk avatar

Watchers

 avatar  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.