It should be possible to start seeding as soon as a torrent is "downloaded" if the contents are found in the output directory. This is how Transmission works on the CLI. The functionality would be especially useful for _webtorrent-hybrid_.
Yeah, this makes sense to me. I would accept a PR for this. :) Busy with other issues right now, but I agree this is important.
Trying to figure out how to do this, but having a pretty tough time getting started. @feross, could you point me in the right direction?
@devTristan Have you taken a look at lib/storage.js and lib/fs-storage.js?
@feross Yeah, I am right now. I saw that a torrent is seeded by loading all of the data into torrent.storage and then... (???)
Maybe I'm wrong about a basic assumption. After client.add, are all files selected or deselected?
+1 for this feature!
+2 for this, I desperately need pause functionality. I'm currently working on just the UI part of my new client, but will probably start the actual data transfer stuff fairly soon. Any takers? Or should I give it a go?
You should give it a go!
@feross Gonna give it a go tonight and see where I get to :) here's hoping!
@MiracleBlue How'd it go?
I struggled with trying to figure out what it takes to actually resume a
partial torrent download (I'm not particularly knowledgible in the Torrent
spec), but I discovered that most clients will do a re-check of the hashes
(or something like that) of the downloaded pieces and determine which
partials are missing, but I was mostly focussed on getting a few of the
last UI bits in to my blue-torrent.
Next weekend I will continue!
On Sat, Aug 29, 2015 at 3:26 AM, Feross Aboukhadijeh <
[email protected]> wrote:
@MiracleBlue https://github.com/MiracleBlue How'd it go?
—
Reply to this email directly or view it on GitHub
https://github.com/feross/webtorrent/issues/320#issuecomment-135839101.
I haven't forgotten about this. Just finding it hard to find the time. Unfortunately I'm not terribly knowledgable with the Torrent spec, so this is certainly a tricky thing for me :) I'm still working away slowly on my little torrent client which is gonna need this functionality.
+1 to seed existing downloads!
+1
I just made a PR that fixes the resumable download portion of this issue. https://github.com/feross/webtorrent/pull/515
Hello @feross any news about this feature? How would you suggest to do it, I may try my chance and open a PR.
Is this possible in a web browser? Can file pieces persist across sessions and still be accessible? Wouldn't there be file size limitations?
I found this which could be useful: http://stackoverflow.com/questions/21015771/what-causes-the-chrome-wants-to-permanently-store-large-data-message
I already did this. Look at my fork for inspiration
Does this not work now? If I run with --keep-seeding it certainly does not seem to re-download... but maybe it's not really seeding?
I'm pretty sure this issue can be closed.
It's possible to resume a torrent by calling client.add() with the option { path: '/path/to/torrent/folder' }. If files exist there with the same names as what is in the torrent, then WebTorrent will verify them and check their contents. Whichever pieces are valid, will be preserved and not re-downloaded.
On the command line, you can do the same with webtorrent "magnet_uri" --out /path/to/torrent/folder.
@feross is webtorrent start seeding as soon as it gets the first piece of data?
@JacopoDaeli Yes.
How can this be done in the browser?
@RationalCoding Sorry for the delayed response. There's not a simple API to get this working in the browser yet, but you can call torrent.add(), then later manually call the undocumented torrent.load() with the partial or completely downloaded torrent contents and that will re-populate the storage.
Alternatively, you can use the documented store argument to specify a custom factory function that returns an abstract-chunk-store compliant storage object that you initialize with the needed data. You can see how this is invoked here: https://github.com/webtorrent/webtorrent/blob/225b6150a9f2bde2519e28d4163ab41adf30e4b6/lib/torrent.js#L1605
Most helpful comment
I'm pretty sure this issue can be closed.
It's possible to resume a torrent by calling
client.add()with the option{ path: '/path/to/torrent/folder' }. If files exist there with the same names as what is in the torrent, then WebTorrent will verify them and check their contents. Whichever pieces are valid, will be preserved and not re-downloaded.On the command line, you can do the same with
webtorrent "magnet_uri" --out /path/to/torrent/folder.