Skip to content

songshusen/archivex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

archivex

archivex is a golang package that archives folders (recursively) and files to zip and tar formats.

Build Status

Installation

$ go get github.com/jhoonb/archivex

Example

package main

import (
	"github.com/jhoonb/archivex"
)

// Example using only func zip
func zip() {
	zip := new(archivex.ZipFile)
	zip.Create("filezip")
	zip.Add("testadd.txt", []byte("test 1"))
	zip.AddFile("<input_path_file_here>")
	zip.AddAll("<input_dir_here", true)
	zip.Close()
}

// Example using only func tar
func tar() {
	tar := new(archivex.TarFile)
	tar.Create("filetar")
	tar.Add("testadd.txt", []byte("test 1"))
	tar.AddFile("<input_path_file_here>")
	tar.AddAll("<input_dir_here", true)
	tar.Close()
}

// Example using interface
func usingInterface() {

	archx := []archivex.Archivex{&archivex.TarFile{}, &archivex.ZipFile{}}

	for _, arch := range archx {
		arch.Create("fileinterface")
		arch.Add("testadd.txt", []byte("file 1 :) "))
		arch.AddFile("<input_path_file_here>")
		arch.AddAll("<input_dir_here", true)
		arch.Close()
	}
}

func main() {

	zip()
	tar()
	usingInterface()
}

:)

About

archivex is a golang package that archives folders (recursively) and files to zip and tar formats.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%