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-05-21 00:00:32 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-05-21 00:00:32 +0300
commit3b44679f51fb157de84033a05feba0602f7f1adf (patch)
tree16da667cb05cb758a91aec401f49f191c4cb26e7
parent052a457b0271e8729aa1018763fda2e93aa7b49f (diff)
add properties to access .torrent file
-rw-r--r--lib/torrent.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/torrent.js b/lib/torrent.js
index 7f63dff..e34041f 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -205,6 +205,20 @@ Object.defineProperty(Torrent.prototype, 'magnetURI', {
}
})
+Object.defineProperty(Torrent.prototype, 'torrentFile', {
+ get: function () {
+ return parseTorrent.toTorrentFile(this.parsedTorrent)
+ }
+})
+
+Object.defineProperty(Torrent.prototype, 'torrentFileURL', {
+ get: function () {
+ return window.URL.createObjectURL(
+ new window.Blob([ this.torrentFile ], { type: 'application/x-bittorrent' })
+ )
+ }
+})
+
Torrent.prototype._onSwarmListening = function () {
var self = this
if (self.destroyed) return