feat(download): implement file assembly with preallocation, WriteAt, resume, cleanup #141
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/pget!141
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/file-assembly"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Enhance file writing and assembly: pre-allocation with Truncate, per-chunk WriteAt positioning, resume support via
-cflag, and cleanup of partial files on failure.Why
Completes the file writing layer — handles output file lifecycle from creation through assembly to cleanup.
Testing
go vet ./...passesgo build ./...passesgolangci-lint run ./...passesBreaking Changes
Download()signature changed — addedresume boolparameter.Notes
openOutput— opens existing file if resume=true and file exists with partial size; creates + pre-allocates otherwise; returns nil if file already completecleanupOutput— removes partial file on failure when resume=false, preserves it when resume=trueio.CopyNbyte count mismatchos.File.Truncatefor sparse file creationCloses #0047
Closes #0048
Closes #0049
Closes #0050
Closes #0051
Review: APPROVED
Verification
go vet ./...— ✅ passesgo build ./...— ✅ passesgolangci-lint v2 run ./...— ✅ 0 issuesChanges
internal/downloader/download.go—openOutputreplacespreallocFile(handles create + resume),cleanupOutputdeletes partial file on failure, removed unusedlogparam from helpers,Download()gainsresume boolparameterROADMAP.md— Marks Phase 2 file assembly items as [x]Suggestions (non-blocking)
fi.Size() >= 0is always true. Related to #138.Closes #0047, #0048, #0049, #0050, #0051 on merge.