Documentation ¶
Overview ¶
Package ziph provides helper functions for the zip package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsyncUnzip ¶
func AsyncUnzip(inputPath, outputPath string, bufSize int, permDir os.FileMode) (chan<- bool, <-chan string, <-chan error)
AsyncUnzip asynchronously unzips inputPath to outputPath; outputPath will be created if it does not exist. Directories are created with permDir permissions. Set the bufSize to the number of files (from GetZipStats) to prevent this function from being blocked output channels not being read fast enough. Progress can be monitored via the returned channels, which return cancel, processed paths, and any errors. The cancel channel can be used to cancel an operation. The operation is complete when both processed paths and errors channels are closed.
func AsyncZip ¶
func AsyncZip(zipPath string, paths []string, trimFilepath []string) (chan<- bool, <-chan string, <-chan error)
AsyncZip asynchronously creates a compressed ZIP file, of file/directories in paths, at zipPath. The paths are turned into absolute paths, then made relative by removing the leading filepath.Separator. When zipped, if trimFilepath !=nil, all strings in trimFilepath are left trimmed from paths to create relative paths. Progress can be monitored via the returned channels, which return cancel, processed paths, and any errors. The cancel channel can be used to cancel an operation. The operation is complete when both processed paths and errors channels are closed.
Types ¶
type ZipStats ¶
type ZipStats struct {
FileCount int
}
ZipStats is for getting statistics on a zip file; currently only supports the number of zip.File in an archive.
func GetZipStats ¶
GetZipStats is for getting statistics on a zip file; currently only supports the number of zip.File in an archive.