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 upOption to destroy store on torrent removal (delete files from disk) #1364
Conversation
This comment has been minimized.
This comment has been minimized.
|
As opts is optional, if you don't included but you have the callback function, this would break the API. The way to fix it is this: https://github.com/webtorrent/webtorrent/pull/1102/files#diff-168726dbe96b3ce427e7fedce31bb0bcR383 Why would you like to replace #1102? |
This comment has been minimized.
This comment has been minimized.
|
Both client.remove() and torrent.destroy() pass both opts and the callback into torrent._destroy before they're used, and I cover that scenario there https://github.com/webtorrent/webtorrent/pull/1364/files#diff-65b0a569f99e647ae33e8c31b9bf72baR647 If the API was broken like that, then these tests would fail https://github.com/webtorrent/webtorrent/blob/master/test/torrent-destroy.js#L19-L22 Should I handle it in all three functions for clarity?
Yeah, looking back at #1102 it seems to almost the same as this with minor differences. I don't remember why I wanted to replace it. I think I didn't look closely enough at the changes and thought it was abandoned. I should've asked there first. Should I close this? It's no big deal. The only real differences between the two are that this one tests for both API functions and works with all custom stores. I could submit a review on the other one for that. |
This comment has been minimized.
This comment has been minimized.
|
Any progress on this? I'm using WebTorrent in the browser and would like to delete file data with |
This comment has been minimized.
This comment has been minimized.
|
You can do this without this PR: torrent.destroy((err) => {
if (err) throw err
torrent.store.destroy((err) => {
if (err) throw err
console.log('destroyed and files removed')
})
})You might have to do it in the opposite order (destroy its store, then the torrent). You also only need to delete it if you use a custom chunk store like idbkv-chunk-store. Otherwise, in the browser, the data is never written to the disk and only temporarily stored in memory. |
This comment has been minimized.
This comment has been minimized.
stale
bot
commented
Mar 12, 2019
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
KayleePop commentedApr 25, 2018
•
edited
Intended to replace #1102
Should work with custom stores like indexeddb as well, but I didn't test that.
API is this:
fixes #1000