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
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/rarity-map.js2
-rw-r--r--lib/server.js4
-rw-r--r--lib/torrent.js10
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/rarity-map.js b/lib/rarity-map.js
index 7630734..af712cc 100644
--- a/lib/rarity-map.js
+++ b/lib/rarity-map.js
@@ -45,7 +45,7 @@ class RarityMap {
if (availability === min) {
candidates.push(i)
} else if (availability < min) {
- candidates = [ i ]
+ candidates = [i]
min = availability
}
}
diff --git a/lib/server.js b/lib/server.js
index 263dcf7..64ce12f 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -3,7 +3,7 @@ const http = require('http')
const mime = require('mime')
const pump = require('pump')
const rangeParser = require('range-parser')
-const url = require('url')
+const URL = require('url').URL
function Server (torrent, opts = {}) {
const server = http.createServer()
@@ -77,7 +77,7 @@ function Server (torrent, opts = {}) {
}
function onRequest (req, res) {
- const pathname = url.parse(req.url).pathname
+ const pathname = new URL(req.url, 'http://example.com').pathname
if (pathname === '/favicon.ico') {
return serve404Page()
diff --git a/lib/torrent.js b/lib/torrent.js
index 14b2caf..7acad70 100644
--- a/lib/torrent.js
+++ b/lib/torrent.js
@@ -1,4 +1,4 @@
-/* global URL, Blob */
+/* global Blob */
const addrToIPPort = require('addr-to-ip-port')
const BitField = require('bitfield')
@@ -46,7 +46,7 @@ const RECHOKE_OPTIMISTIC_DURATION = 2 // 30 seconds
// IndexedDB chunk stores used in the browser benefit from maximum concurrency
const FILESYSTEM_CONCURRENCY = process.browser ? Infinity : 2
-const RECONNECT_WAIT = [ 1000, 5000, 15000 ]
+const RECONNECT_WAIT = [1000, 5000, 15000]
const VERSION = require('../package.json').version
const USER_AGENT = `WebTorrent/${VERSION} (https://webtorrent.io)`
@@ -169,7 +169,7 @@ class Torrent extends EventEmitter {
if (typeof window === 'undefined') throw new Error('browser-only property')
if (!this.torrentFile) return null
return URL.createObjectURL(
- new Blob([ this.torrentFile ], { type: 'application/x-bittorrent' })
+ new Blob([this.torrentFile], { type: 'application/x-bittorrent' })
)
}
@@ -348,7 +348,7 @@ class Torrent extends EventEmitter {
// to allow function hoisting
const self = this
- const urls = Array.isArray(this.xs) ? this.xs : [ this.xs ]
+ const urls = Array.isArray(this.xs) ? this.xs : [this.xs]
const tasks = urls.map(url => cb => {
getMetadataFromURL(url, cb)
@@ -1581,7 +1581,7 @@ class Torrent extends EventEmitter {
if (this.destroyed) throw new Error('torrent is destroyed')
if (!this.ready) return this.once('ready', () => { this.load(streams, cb) })
- if (!Array.isArray(streams)) streams = [ streams ]
+ if (!Array.isArray(streams)) streams = [streams]
if (!cb) cb = noop
const readable = new MultiStream(streams)