Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CLI7z ¶
type CLI7z struct {
BinaryPath string
}
func (*CLI7z) CanExtract ¶
CanExtract checks if the file is a 7z archive
type CLIUnrar ¶
type CLIUnrar struct {
BinaryPath string
}
func NewCLIUnrar ¶
NewCLIUnrar creates a new UnRAR extractor using the system's unrar binary. Returns an error if the unrar binary is not found in PATH.
func (*CLIUnrar) CanExtract ¶
CanExtract checks if the file is a RAR archive by verifying: 1. File extension (.rar) 2. Magic bytes (file signature) 3. For multi-part archives, only extract the first part
type CLIUnzip ¶
type CLIUnzip struct {
BinaryPath string
}
func NewCLIUnzip ¶
func (*CLIUnzip) CanExtract ¶
CanExtract checks if the file is a ZIP archive
type CmdFactory ¶
type Extractor ¶
type Extractor interface {
// Extract extracts the archive at the given path to the destination directory.
// Returns the list of extracted file paths, or an error if extration fails.
Extract(ctx context.Context, archivePath string, destDir string) ([]string, error)
// CanExtract checks if this extractor can handle the given file.
CanExtract(filename string) (bool, error)
// Returns the human-readable name of this extractor (e.g. "RAR", "ZIP")
Name() string
}
Extractor defines the behavior for extracting compress archives
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles multiple extractors and determines which to use
func NewManager ¶
func NewManager() *Manager
NewManager creates a new extraction manager and initilizes available extractors
func (*Manager) AvailableExtractors ¶
AvailableExtractors returns the names of available extractors
func (*Manager) DetectArchives ¶
func (m *Manager) DetectArchives(tasks []*domain.DownloadFile) (map[*domain.DownloadFile]Extractor, error)
DetectArchives scans the completed tasks and returns archives that need extraction Returns a map of task -> extractor for each archive found
func (*Manager) HasExtractors ¶
HasExtractors returns true if any extractors are available