diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-01-10 19:53:40 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-01-11 02:08:59 +0300 |
commit | dd464fd074f94110ba0589c6624d72c391b6bd91 (patch) | |
tree | ba408f2cfe5ca0c3904a30de4c933de22fab7f44 /lib | |
parent | 19a942d6c2215352a35bde3abc5bfed21d9e3fc2 (diff) |
BREAKING: torrent.torrentFileURL renamed to torrent.torrentFileBlobURL
torrent.torrentFileURL -> torrent.torrentFileBlobURL
Diffstat (limited to 'lib')
-rw-r--r-- | lib/torrent.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index 62a0c2d..de859a2 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1,3 +1,5 @@ +/* global URL, Blob */ + module.exports = Torrent var addrToIPPort = require('addr-to-ip-port') // browser exclude @@ -166,12 +168,13 @@ Object.defineProperty(Torrent.prototype, 'numPeers', { get: function () { return this.swarm ? this.swarm.numPeers : 0 } }) -Object.defineProperty(Torrent.prototype, 'torrentFileURL', { +// Torrent file as a blob url +Object.defineProperty(Torrent.prototype, 'torrentFileBlobURL', { get: function () { if (typeof window === 'undefined') throw new Error('browser-only property') if (!this.torrentFile) return null - return window.URL.createObjectURL( - new window.Blob([ this.torrentFile ], { type: 'application/x-bittorrent' }) + return URL.createObjectURL( + new Blob([ this.torrentFile ], { type: 'application/x-bittorrent' }) ) } }) |