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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/torrent.js')
-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)