diff options
author | Kaylee <34007889+KayleePop@users.noreply.github.com> | 2018-04-24 22:03:29 +0300 |
---|---|---|
committer | KayleePop <34007889+KayleePop@users.noreply.github.com> | 2020-04-15 06:01:46 +0300 |
commit | 349afeb831c4709c0878346d64c58bf7387e90f2 (patch) | |
tree | 7c4cec6128a1321a4c74aac75f78f863c31f6a39 /docs | |
parent | fb8392d9f3a60fd0d5727a1d71967c06186844da (diff) |
Docs and tests for store destruction
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 062343b..98bdb1c 100644 --- a/docs/api.md +++ b/docs/api.md @@ -163,12 +163,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) {}])` @@ -319,11 +321,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)` |