util

package
v0.0.0-...-eb159af Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 8 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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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