archive

package
v0.0.0-...-d2a29b3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 4 Imported by: 0

README

archive

This package provides utilities for working with archive formats.

Functions

Unzip
func Unzip(src, dest string) error

Extracts a ZIP archive from src to the dest directory. All files and folders in the archive will be extracted, preserving the directory structure.

Example
import "github.com/Merith-TK/utils/pkg/archive"

err := archive.Unzip("example.zip", "outputDir")
if err != nil {
    // handle error
}

Documentation

Overview

Package archive provides utilities for working with archive formats, currently supporting ZIP extraction.

The package focuses on safe and reliable archive extraction with proper path handling and directory structure preservation. It includes security measures to prevent path traversal attacks and ensures proper file permissions are maintained.

Current functionality:

  • ZIP archive extraction with full directory structure preservation
  • Safe path handling to prevent directory traversal attacks
  • Automatic parent directory creation
  • Proper file permission preservation

Example usage:

err := archive.Unzip("archive.zip", "/path/to/extract")
if err != nil {
	log.Fatal("Failed to extract archive:", err)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unzip

func Unzip(src, dest string) error

Unzip extracts a ZIP archive from src to the dest directory. All files and folders in the archive will be extracted, preserving the directory structure. Returns an error if extraction fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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