diff options
author | Kaylee <34007889+KayleePop@users.noreply.github.com> | 2020-09-10 21:38:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-10 21:38:44 +0300 |
commit | 7aee819796c540df0b247fec1853098f9a591d4c (patch) | |
tree | 6eb6ac35de0fed83e3e2470a3e647645c8bfa240 /docs | |
parent | 9ae31e5d8a44b98a768971efb7c6b7b386eb9447 (diff) | |
parent | 3393e92166d7049dc84e2d488b4769c668ee3b20 (diff) |
Merge pull request #1364 from KayleePop/destroy
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api.md | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/docs/api.md b/docs/api.md index e178c18..1532a89 100644 --- a/docs/api.md +++ b/docs/api.md @@ -165,12 +165,14 @@ destroyed and all torrents are removed and cleaned up when this occurs. Always listen for the 'error' event. -## `client.remove(torrentId, [function callback (err) {}])` +## `client.remove(torrentId, [opts], [function callback (err) {}])` -Remove a torrent from the client. Destroy all connections to peers and delete all saved -file data. If `callback` is specified, it will be called when file data is removed. +Remove a torrent from the client. Destroy all connections to peers and delete all saved file metadata. -*Note: This method does not currently delete torrent data (in e.g. `/tmp/webtorrent/...`, see the `path` option to `client.add`). Until this is fixed, please implement it yourself (consider using the `rimraf` npm package). +If `opts.destroyStore` is truthy, `store.destroy()` will be called, which will delete the torrent's files from the disk. + +If `callback` is provided, it will be called when the torrent is fully destroyed, +i.e. all open sockets are closed, and the storage is either closed or destroyed. ## `client.destroy([function callback (err) {}])` @@ -321,11 +323,14 @@ Author of the torrent (string). A comment optionnaly set by the author (string). -## `torrent.destroy([callback])` +## `torrent.destroy([opts], [callback])` + +Remove the torrent from its client. Destroy all connections to peers and delete all saved file metadata. + +If `opts.destroyStore` is truthy, `store.destroy()` will be called, which will delete the torrent's files from the disk. -Alias for `client.remove(torrent)`. If `callback` is provided, it will be called when -the torrent is fully destroyed, i.e. all open sockets are closed, and the storage is -closed. +If `callback` is provided, it will be called when the torrent is fully destroyed, +i.e. all open sockets are closed, and the storage is either closed or destroyed. ## `torrent.addPeer(peer)` |