Skip to content

feat(download): implement selective file download for multi-file torrents#39

Closed
arjavlamsal wants to merge 1 commit into
baairon:mainfrom
arjavlamsal:implement-selective-torrent-download
Closed

feat(download): implement selective file download for multi-file torrents#39
arjavlamsal wants to merge 1 commit into
baairon:mainfrom
arjavlamsal:implement-selective-torrent-download

Conversation

@arjavlamsal

Copy link
Copy Markdown

What and why

Multi-file torrents currently download all containing files, wasting bandwidth and disk space when the user only wants specific files. This adds an inline file-selection checklist in the search results detail view so users can pick exactly which files to grab before starting the download.

  • Engine: applyFileSelection deselects unwanted files at the piece level; added per-file progress tracking and selective totalBytes calculation.
  • Queue: add() accepts selectedIndices; onMetadata applies selection and recalculates size; cleanUnwanted relocates deselected piece data to a hidden .unwanted/ directory on completion.
  • Detail View: Temporary metadata-only fetch populates the file list without committing to a download; auto-cleanup of the engine client on navigation away.
  • Keys: space toggle · a all · n none (all registered in HELP_GROUPS cheatsheet).
  • UI Presentation: Display paths strip the torrent root folder prefix for cleaner readability.

Checklist

  • npm run typecheck is clean
  • npm test passes
  • New logic has a test (queue.test.ts covers selectedIndices and metadata recalculations)
  • Added keys are updated in both HELP_GROUPS and footerHints in src/ui/keymap.ts
  • No new Store fields were added (reused existing startDownload configuration)
  • OS-touching code works on Windows, macOS, and Linux (uses standard node:fs / node:path)
  • One concern, with a Conventional Commits title (feat(download): ...)

…ents

Multi-file torrents currently download everything, wasting bandwidth and
disk space when the user only wants specific files. This adds an inline
file-selection checklist in the search results detail view so users can
pick exactly which files to grab before starting the download.

- Engine: applyFileSelection deselects unwanted files at the piece level;
  per-file progress tracking; selective totalBytes computation.
- Queue: add() accepts selectedIndices; onMetadata applies selection and
  recalculates size; cleanUnwanted relocates deselected piece data to a
  hidden .unwanted/ directory on completion.
- Detail view: temporary metadata-only fetch populates the file list
  without committing to a download; auto-cleanup on navigation away.
- Keys: space toggle, a all, n none (registered in HELP_GROUPS).
- Display paths strip the torrent root folder prefix for readability.
@sameer14320081-creage

Copy link
Copy Markdown

so is it good and trusted
?

@arjavlamsal

Copy link
Copy Markdown
Author

so is it good and trusted ?

The logic itself is solid and clean, it passes all the local tests, has typechecking enabled, and includes dedicated new unit tests for the selective download queuing. I've been trying it out and haven't had any issue.

@sloevhaug

Copy link
Copy Markdown

This is great! Tested locally and then i added file path input per torrent on top of this: #43

@arjavlamsal

Copy link
Copy Markdown
Author

Closing this since @sloevhaug has cleanly integrated this logic and resolved the conflicts over in #43 . Thanks for the awesome collab!

@arjavlamsal arjavlamsal closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants