zip

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MulanPSL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZipFile

func IsZipFile(filepath string) (bool, error)

IsZipFile reports file whether is a zip file. About the zip file format can refer to https://docs.fileformat.com/compression/zip/.

func Unzip

func Unzip(zipath, dir string) error

Unzip decompresses a zip file to specified directory. Note that the destination directory don't need to specify the trailing path separator. If the destination directory doesn't exist, it will be created automatically.

func Zip

func Zip(zipPath string, paths ...string) error

Zip compresses the specified files or dirs to zip archive. If a path is a dir don't need to specify the trailing path separator. For example calling Zip("archive.zip", "dir", "csv/baz.csv") will get archive.zip and the content of which is baz.csv dir ├── bar.txt └── foo.txt Note that if a file is a symbolic link on Linux it will be skipped. If you want to follow a symbolic link please use the function ZipFollowSymlink.

func ZipFollowSymlink(zipPath string, paths ...string) error

ZipFollowSymlink compresses the specified files or dirs to zip archive. If the specified files or dirs is a symbolic link ZipFollowSymlink will follow it. Note that the symbolic link need to avoid loops.

Types

This section is empty.

Jump to

Keyboard shortcuts

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