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:
authorFeross Aboukhadijeh <feross@feross.org>2015-08-28 21:46:41 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-08-28 21:46:41 +0300
commit0910056b48a33793f422eed923b788666e3d9a13 (patch)
tree20d4a593d1e19550cbb1fc27314be64993765488
parent41a6b3f60b22fd1996e249507a5e2719e71e3d57 (diff)
expose torrent.path in a clean way (fix #409)
-rw-r--r--lib/torrent.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index c7c7521..9d4ecdf 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -61,7 +61,7 @@ function Torrent (torrentId, opts) {
self.announce = opts.announce
self.urlList = opts.urlList
- self._path = opts.path
+ self.path = opts.path
self._store = opts.store || FSChunkStore
self.strategy = opts.strategy || 'sequential'
@@ -99,11 +99,6 @@ Object.defineProperty(Torrent.prototype, 'timeRemaining', {
}
})
-// Torrent Path
-Object.defineProperty(Torrent.prototype, 'path', {
- get: function () { return this._path; }
-})
-
// Bytes completed (excluding invalid data)
Object.defineProperty(Torrent.prototype, 'downloaded', {
get: function () {
@@ -197,7 +192,7 @@ Torrent.prototype._onParsedTorrent = function (parsedTorrent) {
return self._onError(new Error('Malformed torrent data: No info hash'))
}
- if (!self._path) self._path = path.join(TMP, self.infoHash)
+ if (!self.path) self.path = path.join(TMP, self.infoHash)
// create swarm
self.swarm = new Swarm(self.infoHash, self.client.peerId, {
@@ -323,7 +318,7 @@ Torrent.prototype._onMetadata = function (metadata) {
new self._store(self.pieceLength, {
files: self.files.map(function (file) {
return {
- path: path.join(self._path, file.path),
+ path: path.join(self.path, file.path),
length: file.length,
offset: file.offset
}