Skip to content

dreamph/gozip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gozip

Golang Zip File

  • Simple, Easy
  • Support File or Directory

Example

package main

import (
	"github.com/dreamph/gozip"
	"log"
)

func main() {
	// Zip
	err := gozip.Zip("example/output/test.zip", []string{"example/dir1", "example/test-file.txt"})
	if err != nil {
		log.Fatal("Zip file error.", err)
	}

	// Zip with password
	err = gozip.Zip("example/output/test-with-password.zip", []string{"example/dir1", "example/test-file.txt"}, "password")
	if err != nil {
		log.Fatal("Zip file error.", err)
	}

	// Unzip
	err = gozip.Unzip("example/output/test.zip", "example/output/test")
	if err != nil {
		log.Fatal("Zip file error.", err)
	}

	// Unzip with password
	err = gozip.Unzip("example/output/test-with-password.zip", "example/output/test-with-password", "password")
	if err != nil {
		log.Fatal("Zip file error.", err)
	}
}

Buy Me a Coffee

"Buy Me A Coffee"