Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep files that were selected elsewhere #114

Closed
nevercast opened this issue May 4, 2015 · 2 comments
Closed

Keep files that were selected elsewhere #114

nevercast opened this issue May 4, 2015 · 2 comments
Labels

Comments

@nevercast
Copy link

Hello,

I couldn't find any questions that matched this one so I've posted mine.
Is there a way to determine (Without tracking files in my own application, avoiding redundancy) if a file was selected for full download instead of the entire file just being streamed.

In some cases when streaming a file to clients, a client might elect to have the file saved so that it's available again in the future without re-downloading.

I intend to have a cache folder for all streamed files that is cleared oldest first to prevent my HDD filling up as content is streamed. Is there a way to easily determine if the file was selected (and should be moved to be kept) ?

I wish to listen for the download event and move the file to another location so that it is not aged-off my HDD at a later stage.

@nevercast nevercast changed the title Keep files that were selected Keep files that were selected elsewhere May 5, 2015
@asapach
Copy link
Collaborator

asapach commented May 5, 2015

First off, this seems like a bad idea, since it contradicts the bittorrent protocol expectations: one a peer has downloaded a piece, it should be able to seed it. If you delete the downloaded file, you will be unable to do so, and will break the protocol. So unless you become a leech (never seed) or leave the swarm entirely (don't make or accept peer connections), you can't delete the stored files.

I wish to listen for the download event and move the file to another location so that it is not aged-off my HDD at a later stage.

I believe 'download' event is emitted for each downloaded piece, not file. So you'd first have to check if a file is downloaded completely.

Is there a way to easily determine if the file was selected (and should be moved to be kept) ?

Selected means that t-s will try to download all the pieces that comprise a file. You can check the selection property, here's an example. Whether it's complete is a different story entirely: #113. Once a file is complete, it's no longer selected.

@nevercast
Copy link
Author

nevercast commented May 5, 2015 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants