Documentation
¶
Index ¶
- type Differ
- func (d *Differ) ApplyPatch(oldFilePath string, patchData []byte) ([]byte, error)
- func (d *Differ) ApplyPatchToData(oldData, patchData []byte) ([]byte, error)
- func (d *Differ) ApplyPatchToFile(oldFilePath, outputPath string, patchData []byte) error
- func (d *Differ) CompareSizes(oldSize, newSize int64) (delta int64, percent float64)
- func (d *Differ) CopyFileChunked(srcPath, dstPath string, chunkSize int64, ...) error
- func (d *Differ) EstimatePatchSize(oldSize, newSize int64, similarity float64) int64
- func (d *Differ) GenerateDiff(oldFilePath, newFilePath string) ([]byte, error)
- func (d *Differ) GenerateDiffChunked(oldFilePath, newFilePath string, chunkSize int64, ...) (string, int64, error)
- func (d *Differ) GenerateDiffFromData(oldData, newData []byte) ([]byte, error)
- func (d *Differ) GenerateDiffStreaming(oldFilePath, newFilePath string, output io.Writer) error
- func (d *Differ) IsLargeFile(filePath string) (bool, int64, error)
- func (d *Differ) ValidatePatch(patchData []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Differ ¶
type Differ struct{}
Differ handles binary diff operations
func (*Differ) ApplyPatch ¶
ApplyPatch applies a binary patch to a file
func (*Differ) ApplyPatchToData ¶
ApplyPatchToData applies a binary patch to byte data
func (*Differ) ApplyPatchToFile ¶
ApplyPatchToFile applies a binary patch and writes the result to a file
func (*Differ) CompareSizes ¶
CompareSizes returns the size difference between old and new data
func (*Differ) CopyFileChunked ¶
func (d *Differ) CopyFileChunked(srcPath, dstPath string, chunkSize int64, progressCallback func(processed, total int64)) error
CopyFileChunked copies a large file in chunks without loading entire file into memory
func (*Differ) EstimatePatchSize ¶
EstimatePatchSize estimates the patch size based on file sizes This is a rough estimate and actual size may vary
func (*Differ) GenerateDiff ¶
GenerateDiff generates a binary diff between two files
func (*Differ) GenerateDiffChunked ¶
func (d *Differ) GenerateDiffChunked(oldFilePath, newFilePath string, chunkSize int64, progressCallback func(processed, total int64)) (string, int64, error)
GenerateDiffChunked generates a diff for very large files by processing in chunks For large files (>1GB), this uses full file replacement instead of binary diff: - Binary diff (bsdiff) requires loading both files fully into memory (e.g., 2x1.5GB = 3GB) - For large files, full replacement is more memory-efficient and reliable - Returns the source file path so caller can stream it directly - Applier will handle this as a full file replacement, copying in chunks
func (*Differ) GenerateDiffFromData ¶
GenerateDiffFromData generates a binary diff from byte slices
func (*Differ) GenerateDiffStreaming ¶
GenerateDiffStreaming generates a binary diff for large files using streaming
func (*Differ) IsLargeFile ¶
IsLargeFile checks if a file exceeds the large file threshold
func (*Differ) ValidatePatch ¶
ValidatePatch validates that patch data appears to be valid bsdiff format