ziparchiver

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package ziparchiver provides an archiver adapter using the archive/zip package.

Index

Constants

View Source
const MaxDecompressSize = 10 * 1024 * 1024 * 1024 // 10GB

MaxDecompressSize is the maximum allowed uncompressed file size (10GB). This prevents decompression bomb attacks (G110).

Variables

This section is empty.

Functions

This section is empty.

Types

type ZipArchiver

type ZipArchiver struct{}

ZipArchiver implements ports.Archiver using archive/zip.

func New

func New() *ZipArchiver

New creates a new ZipArchiver adapter.

func (*ZipArchiver) Create

func (a *ZipArchiver) Create(destPath, sourceDir string, exclude []string) (int, error)

Create creates a zip archive of sourceDir at destPath. Returns the number of files archived. exclude is a list of patterns to skip (e.g., "node_modules", "*.pyc").

func (*ZipArchiver) Extract

func (a *ZipArchiver) Extract(zipPath, destDir string) error

Extract extracts a zip archive to destDir.

func (*ZipArchiver) List

func (a *ZipArchiver) List(zipPath string) (map[string]ports.FileInfo, error)

List returns a map of file paths to their info from the archive. The path key has the project prefix stripped.

func (*ZipArchiver) ReadFile

func (a *ZipArchiver) ReadFile(zipPath, filePath, projectName string) (string, error)

ReadFile reads the contents of a file from inside a zip archive.

Jump to

Keyboard shortcuts

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