Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature Request: control select/deselect default on new torrents #873
Labels
Comments
This comment has been minimized.
This comment has been minimized.
|
Again, happy to do the legwork on implementing this if it seems like a sane thing to do. |
This comment has been minimized.
This comment has been minimized.
|
I would actually like if we could set all files deselected by default. The .select() or .deselect() file api calls seem pretty heavy on a slow CPU like an Atom Z3735, and as I only play 1 video file at a time, I usually have to deselect all files, then reselect the one I wanna play, which, in case of a 8 to 20 files torrent can take between 5 and 30 sec (on an atom again, on an i5 it goes nearly instant). |
This comment has been minimized.
This comment has been minimized.
|
@retrohacker did you ever find a workaround for this? edit i found this workaround, will try #164 (comment) |
This comment has been minimized.
This comment has been minimized.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

I've seen this raised several times (i.e. #758), and I would find it useful for PeerWeb.
When a new torrent is added to a client, it has the files in the torrent set to selected by default. It would be nice to be able to change this so you could fetch the metadata and then control which files you want to download at what priority from there.
This would clean up the logic when you need a single file from a massive torrent (>1k files).
I would like to propose adding a setting to the opts of
client.addthat would allow you to control whether the files in a torrent are selected or deselected by default:client.add(torrentId, [opts], [function ontorrent (torrent) {}])Start downloading a new torrent.
torrentIdcan be one of:If
optsis specified, then the default options (shown below) will be overridden.{ announce: [], // Torrent trackers to use (added to list in .torrent or magnet uri) getAnnounceOpts: Function, // Custom callback to allow sending extra parameters to the tracker maxWebConns: Number, // Max number of simultaneous connections per web seed [default=4] path: String, // Folder to download files to (default=`/tmp/webtorrent/`) store: Function, // Custom chunk store (must follow [abstract-chunk-store](https://www.npmjs.com/package/abstract-chunk-store) API) startDownload: Boolean // Automatically start downloading the files once metadata is available }If
ontorrentis specified, then it will be called when this torrent is ready to beused (i.e. metadata is available). Note: this is distinct from the 'torrent' event which
will fire for all torrents.
If you want access to the torrent object immediately in order to listen to events as the
metadata is fetched from the network, then use the return value of
client.add. If youjust want the file data, then use
ontorrentor the 'torrent' event.If you provide
opts.store, it will be called asopts.store(chunkLength, storeOpts)with:storeOpts.length- size of all the files in the torrentstoreOpts.files- an array of torrent file objectsstoreOpts.torrent- the torrent instance being stored