🚧 Work in progress
See also: examples/main.go
.
a, _ := zip.CreateArchive("test.zip")
defer a.Close()
a.Add(".", "test")
Optionally function function can be provided, to ignore specific files or directories.
a, _ := zip.CreateArchive("test.zip")
defer a.Close()
a.Add(".", "test", func(path string, sourcePath string) bool {
// The file / directory will be ignored if `false` is returned
if path == ".git" {
fmt.Println("> Ignore:", path)
return false
}
fmt.Println("> Add: ", path)
return true
})
a, _ := zip.OpenArchive("test.zip")
defer a.Close()
filePaths, _ := a.List()
for _, f := range filePaths {
fmt.Println(f)
}
- Extract archive