diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2015-05-21 00:00:32 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2015-05-21 00:00:32 +0300 |
commit | 3b44679f51fb157de84033a05feba0602f7f1adf (patch) | |
tree | 16da667cb05cb758a91aec401f49f191c4cb26e7 | |
parent | 052a457b0271e8729aa1018763fda2e93aa7b49f (diff) |
add properties to access .torrent file
-rw-r--r-- | lib/torrent.js | 14 |
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 |