Files
decypharr/pkg/rar/types.go
Elias Benbourenane fbd6cd5038 Random access for RARed RealDebrid torrents (#61)
* feat: AI translated port of RARAR.py in Go

* feat: Extract and cache byte ranges of RARed RD torrents

* feat: Stream and download files with byte ranges if specified

* refactor: Use a more structured data format for byte ranges

* fix: Rework streaming to fix error handling

* perf: More efficient RAR file pre-processing

* feat: Made the RAR unpacker an optional config option

* refactor: Remove unnecessary Rar prefix for more idiomatic code

* refactor: More appropriate private method declaration

* feat: Error handling for parsing RARed torrents with retry requests and EOF validation

* fix: Correctly parse unicode file names

* fix: Handle special character conversion for RAR torrent file names

* refactor: Removed debug logs

* feat: Only allow two concurrent RAR unpacking tasks

* fix: Include "<" and ">" as unsafe chars for RAR unpacking

* refactor: Seperate types into their own file

* refactor: Don't read RAR files on reader initialization
2025-05-27 16:10:23 -07:00

38 lines
695 B
Go

package rar
import (
"net/http"
"time"
)
// File represents a file entry in a RAR archive
type File struct {
Path string
Size int64
CompressedSize int64
Method byte
CRC uint32
IsDirectory bool
DataOffset int64
NextOffset int64
}
// Access point for a RAR archive served through HTTP
type HttpFile struct {
URL string
Position int64
Client *http.Client
FileSize int64
MaxRetries int
RetryDelay time.Duration
}
// Reader reads RAR3 format archives
type Reader struct {
File *HttpFile
ChunkSize int
Marker int64
HeaderEndPos int64 // Position after the archive header
Files []*File
}