zip

package module
v0.0.0-...-03943dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 4 Imported by: 2

README

zip

golang zip directory and unzip file

Index
func File(src string, dst string) error 
func Dir(src string, dst string, includeSrc bool) error
func Unzip(zipFile string, destDir string) error
Usage
go get -u github.com/fuxingZhang/zip
package main

import (
	"github.com/fuxingZhang/zip"
	"fmt"
)

func main() {
	src, zipFile, unzipDir := "./test", "./from_test.zip", "./unzip"
	err := zip.Dir(src, zipFile, true)
	if err != nil {
		fmt.Println(err)
	}
	err = zip.Unzip(zipFile, unzipDir)
	if err != nil {
		fmt.Println(err)
	}
}
test
go test
# Show details
go test -v
# or
go test -run TestFile
go test -run TestDir
go test -run TestUnzip

go test -run ^TestFile$
go test -run ^TestFile$ zip
go test -v -run "TestFile|TestDir"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir(src string, dst string, includeSrc bool) error

Dir Compress a directory into a zip file

func File

func File(src string, dst string) error

File Compress a file into a zip file

func Unzip

func Unzip(zipFile string, dstDir string) error

Unzip Unzip zip file

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL