diff options
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | examples/node-save-to-file-system.js | 4 | ||||
-rw-r--r-- | test/fixtures/sintel-5gb.torrent | bin | 26474 -> 0 bytes | |||
-rw-r--r-- | test/node/download-dht-magnet.js | 7 | ||||
-rw-r--r-- | test/node/download-dht-torrent.js | 2 | ||||
-rw-r--r-- | test/node/download-private-dht.js | 2 | ||||
-rw-r--r-- | test/node/download-tracker-magnet.js | 6 | ||||
-rw-r--r-- | test/node/download-webseed-magnet.js | 9 |
8 files changed, 17 insertions, 21 deletions
@@ -125,9 +125,9 @@ standards (no plugins, just HTML5 and WebRTC)! It's easy to get started! var WebTorrent = require('webtorrent') var client = new WebTorrent() -var magnetUri = '...' +var magnetURI = '...' -client.add(magnetUri, function (torrent) { +client.add(magnetURI, function (torrent) { // Got torrent metadata! console.log('Client is downloading:', torrent.infoHash) @@ -421,9 +421,9 @@ Here is a usage example: ```js var client = new WebTorrent() -var magnetUri = '...' +var magnetURI = '...' -client.add(magnetUri, function (torrent) { +client.add(magnetURI, function (torrent) { // create HTTP server for this torrent var server = torrent.createServer() server.listen(port) // start the server listening to a port diff --git a/examples/node-save-to-file-system.js b/examples/node-save-to-file-system.js index a2b1974..657d778 100644 --- a/examples/node-save-to-file-system.js +++ b/examples/node-save-to-file-system.js @@ -2,9 +2,9 @@ var WebTorrent = require('webtorrent') var fs = require('fs') var client = new WebTorrent() -var magnetUri = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d' +var magnetURI = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d' -client.download(magnetUri, function (torrent) { +client.download(magnetURI, function (torrent) { // Got torrent metadata! console.log('Torrent magnet link:', torrent.magnetURI) diff --git a/test/fixtures/sintel-5gb.torrent b/test/fixtures/sintel-5gb.torrent Binary files differdeleted file mode 100644 index 49c35de..0000000 --- a/test/fixtures/sintel-5gb.torrent +++ /dev/null diff --git a/test/node/download-dht-magnet.js b/test/node/download-dht-magnet.js index eb2e56d..9ddba86 100644 --- a/test/node/download-dht-magnet.js +++ b/test/node/download-dht-magnet.js @@ -14,7 +14,6 @@ test('Download using DHT (via magnet uri)', function (t) { dhtServer.on('error', function (err) { t.fail(err) }) dhtServer.on('warning', function (err) { t.fail(err) }) - var magnetUri = 'magnet:?xt=urn:btih:' + common.leaves.parsedTorrent.infoHash var client1, client2 series([ @@ -56,7 +55,7 @@ test('Download using DHT (via magnet uri)', function (t) { var announced = false var loaded = false function maybeDone () { - if (announced && loaded) cb(null, client1) + if (announced && loaded) cb(null) } }, @@ -86,12 +85,12 @@ test('Download using DHT (via magnet uri)', function (t) { }) }) - client2.add(magnetUri) + client2.add(common.leaves.magnetURI) var gotBuffer = false var gotDone = false function maybeDone () { - if (gotBuffer && gotDone) cb(null, client2) + if (gotBuffer && gotDone) cb(null) } } ], function (err) { diff --git a/test/node/download-dht-torrent.js b/test/node/download-dht-torrent.js index fc918bd..b6262c3 100644 --- a/test/node/download-dht-torrent.js +++ b/test/node/download-dht-torrent.js @@ -84,7 +84,7 @@ test('Download using DHT (via .torrent file)', function (t) { var torrentDone = false var gotBuffer = false function maybeDone () { - if (torrentDone && gotBuffer) cb(null, client2) + if (torrentDone && gotBuffer) cb(null) } }) diff --git a/test/node/download-private-dht.js b/test/node/download-private-dht.js index ca0a8e3..ee5125e 100644 --- a/test/node/download-private-dht.js +++ b/test/node/download-private-dht.js @@ -80,7 +80,7 @@ test('public torrent should use DHT', function (t) { torrent.on('dhtAnnounce', function () { t.pass('client announced to dht') - cb(null, client) + cb(null) }) client.on('torrent', function () { diff --git a/test/node/download-tracker-magnet.js b/test/node/download-tracker-magnet.js index 919957b..12607e7 100644 --- a/test/node/download-tracker-magnet.js +++ b/test/node/download-tracker-magnet.js @@ -30,7 +30,7 @@ function magnetDownloadTest (t, serverType) { }) var parsedTorrent = extend(common.leaves.parsedTorrent) - var magnetUri, client1, client2 + var magnetURI, client1, client2 series([ function (cb) { @@ -44,7 +44,7 @@ function magnetDownloadTest (t, serverType) { : 'udp://127.0.0.1:' + port parsedTorrent.announce = [ announceUrl ] - magnetUri = 'magnet:?xt=urn:btih:' + parsedTorrent.infoHash + '&tr=' + encodeURIComponent(announceUrl) + magnetURI = 'magnet:?xt=urn:btih:' + parsedTorrent.infoHash + '&tr=' + encodeURIComponent(announceUrl) client1 = new WebTorrent({ dht: false }) @@ -98,7 +98,7 @@ function magnetDownloadTest (t, serverType) { } }) - client2.add(magnetUri) + client2.add(magnetURI) } ], function (err) { diff --git a/test/node/download-webseed-magnet.js b/test/node/download-webseed-magnet.js index c55683f..b963446 100644 --- a/test/node/download-webseed-magnet.js +++ b/test/node/download-webseed-magnet.js @@ -10,8 +10,6 @@ var WebTorrent = require('../../') test('Download using webseed (via magnet uri)', function (t) { t.plan(9) - var parsedTorrent = common.leaves.parsedTorrent - var serve = serveStatic(path.join(__dirname, 'content')) var httpServer = http.createServer(function (req, res) { var done = finalhandler(req, res) @@ -58,7 +56,7 @@ test('Download using webseed (via magnet uri)', function (t) { maybeDone() }) - client1.add(parsedTorrent) + client1.add(common.leaves.parsedTorrent) }, function (cb) { @@ -68,8 +66,7 @@ test('Download using webseed (via magnet uri)', function (t) { client2.on('warning', function (err) { t.fail(err) }) var webSeedUrl = 'http://localhost:' + httpServer.address().port + '/' + common.leaves.parsedTorrent.name - var magnetUri = 'magnet:?xt=urn:btih:' + parsedTorrent.infoHash + - '&ws=' + encodeURIComponent(webSeedUrl) + var magnetURI = common.leaves.magnetURI + '&ws=' + encodeURIComponent(webSeedUrl) client2.on('torrent', function (torrent) { torrent.files.forEach(function (file) { @@ -98,7 +95,7 @@ test('Download using webseed (via magnet uri)', function (t) { torrent.addPeer('127.0.0.1:' + client1.address().port) }) - client2.add(magnetUri) + client2.add(magnetURI) } ], function (err) { t.error(err) |