zip

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package zip provides utilities for creating and extracting zip archives.

This package wraps the archive/zip standard library to provide convenient functions for working with zip compressed files.

Features:

  • Compress multiple files and directories into zip
  • Extract zip archives while preserving structure
  • Recursive directory processing
  • File mode preservation

Example usage:

err := zip.Compress("archive.zip", []string{"./docs", "./images"})
err := zip.Decompress("archive.zip", "./extracted")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(name string, paths []string) error

Compress compresses multiple files and directories into zip format.

Parameters:

  • name: output zip file path (e.g., "test.zip")
  • paths: slice of file/directory paths to compress

The function recursively processes directories and preserves file modes.

Example:

err := zip.Compress("test.zip", []string{"./test", "./test.txt"})

func Decompress

func Decompress(name, outputPath string) error

Decompress extracts a zip archive to the specified directory.

Parameters:

  • name: input zip file path (e.g., "test.zip")
  • outputPath: output directory path where files will be extracted

The function preserves directory structure and file modes.

Example:

err := zip.Decompress("test.zip", "./output")

Types

This section is empty.

Jump to

Keyboard shortcuts

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