Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Hiesey <john@hiesey.com>2021-03-25 04:09:35 +0300
committerJohn Hiesey <john@hiesey.com>2021-03-25 04:09:35 +0300
commit88ce7aff3c6c43599d1cd2c26d6b15362cc1e94a (patch)
tree15f18d223452de6e87d12d9d24fcd288e8a9624e /lib
parente669ab2cb0488b042ff4bca5ab1549f636f6787d (diff)
Add opts.destroyStoreOnDestroy to torrent
Diffstat (limited to 'lib')
-rw-r--r--lib/torrent.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index db3bebe..ca58842 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -74,6 +74,7 @@ class Torrent extends EventEmitter {
this.skipVerify = !!opts.skipVerify
this._store = opts.store || FSChunkStore
this._preloadedStore = opts.preloadedStore || null
+ this._destroyStoreOnDestroy = opts.destroyStoreOnDestroy || false
this._getAnnounceOpts = opts.getAnnounceOpts
// if defined, `opts.private` overrides default privacy of torrent
@@ -701,8 +702,12 @@ class Torrent extends EventEmitter {
}
if (this.store) {
+ let destroyStore = this._destroyStoreOnDestroy
+ if (opts && opts.destroyStore !== undefined) {
+ destroyStore = opts.destroyStore
+ }
tasks.push(cb => {
- if (opts && opts.destroyStore) {
+ if (destroyStore) {
this.store.destroy(cb)
} else {
this.store.close(cb)