Documentation
¶
Overview ¶
Package ziparchiver provides an archiver adapter using the archive/zip package.
Index ¶
- Constants
- type ZipArchiver
- func (a *ZipArchiver) Create(destPath, sourceDir string, exclude []string) (int, error)
- func (a *ZipArchiver) Extract(zipPath, destDir string) error
- func (a *ZipArchiver) List(zipPath string) (map[string]ports.FileInfo, error)
- func (a *ZipArchiver) ReadFile(zipPath, filePath, projectName string) (string, error)
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 (*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.
Click to show internal directories.
Click to hide internal directories.