Documentation
¶
Overview ¶
Package compression provides utilities for extracting and decompressing plugin archives.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetArchiveBaseName ¶
GetArchiveBaseName extracts the base name from an archive filename. For example: "tinct-plugin-wob_0.0.1_Linux_x86_64.tar.gz" -> "tinct-plugin-wob".
Types ¶
type ExtractResult ¶
type ExtractResult struct {
// Path to the extracted plugin file
Path string
// Whether the input was an archive (true) or a direct file (false)
WasArchive bool
}
ExtractResult contains the result of an extraction operation.
func ExtractPlugin ¶
func ExtractPlugin(data []byte, url, filename, targetFile, archiveName, destDir, contentType string, verbose bool) (*ExtractResult, error)
ExtractPlugin detects format and extracts a plugin from downloaded data. It handles: - Tar archives (.tar.gz, .tar.xz, .tar.bz2) - Zip archives (.zip) - Standalone compressed files (.gz, .xz, .bz2) - Raw uncompressed files (.py, .sh, binaries)
Parameters:
- data: The downloaded file data
- url: Original download URL (used for format detection)
- filename: Base filename (used for naming output)
- targetFile: Optional specific file to extract from archive (e.g., "tinct-plugin-wob")
- archiveName: Base name of archive for finding plugin binary (e.g., "tinct-plugin-wob")
- destDir: Destination directory for extracted files
- contentType: HTTP Content-Type header (optional, used for detection)
- verbose: Whether to print extraction progress
Returns the path to the extracted plugin file.
Click to show internal directories.
Click to hide internal directories.