Documentation ¶
Overview ¶
Package zip provides methods for unpacking files with ZIP compression
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNilReader = fmt.Errorf("Reader can not be nil") ErrEmptyOutput = fmt.Errorf("Path to output directory can not be empty") )
View Source
var MaxReadLimit int64 = 1024 * 1024 * 1024
MaxReadLimit is the maximum read limit for decompression bomb protection (default: 1GB)
Functions ¶
func Read ¶
Read reads compressed data using given reader and unpacks it to the given directory
Example ¶
file := "file.zip" fd, err := os.OpenFile(file, os.O_RDONLY, 0) if err != nil { fmt.Printf("Error: Can't unpack %s: %v\n", file, err) return } err = Read(fd, "/home/bob/data") if err != nil { fmt.Printf("Error: Can't unpack %s: %v\n", file, err) return } fmt.Printf("File %s successfully unpacked!\n", file)
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.