bittorrent-tracker
Advanced tools
Comparing version 0.4.0 to 0.4.1
19
index.js
exports.Client = Client | ||
exports.Server = Server | ||
var bignum = require('bignum') | ||
// optional compiled dependency. if it doesn't compile, no big deal. | ||
var bignum | ||
try { | ||
bignum = require('bignum') | ||
} catch (e) {} | ||
var bncode = require('bncode') | ||
@@ -21,2 +26,3 @@ var compact2string = require('compact2string') | ||
var EVENTS = { completed: 1, started: 2, stopped: 3 } | ||
var MAX_UINT = 4294967295 | ||
@@ -526,3 +532,12 @@ inherits(Client, EventEmitter) | ||
function toUInt64 (n) { | ||
return bignum(n).toBuffer({ size: 8 }) | ||
if (typeof bignum === 'function') { | ||
return bignum(n).toBuffer({ size: 8 }) | ||
} else { | ||
// optional compiled dependency 'bignum' is not available, so round down to MAX_UINT. | ||
// These values are only used for tracker stats anyway. | ||
if (n > MAX_UINT) { | ||
n = MAX_UINT | ||
} | ||
return Buffer.concat([toUInt32(0), toUInt32(n)]) | ||
} | ||
} | ||
@@ -529,0 +544,0 @@ |
{ | ||
"name": "bittorrent-tracker", | ||
"description": "Simple, robust, BitTorrent tracker (client & server) implementation", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"author": { | ||
@@ -14,3 +14,2 @@ "name": "Feross Aboukhadijeh", | ||
"dependencies": { | ||
"bignum": "^0.6.2", | ||
"bncode": "^0.5.2", | ||
@@ -26,6 +25,9 @@ "compact2string": "^1.2.0", | ||
"devDependencies": { | ||
"parse-torrent": "^0.6.0", | ||
"parse-torrent": "^0.9.0", | ||
"portfinder": "^0.2.1", | ||
"tape": "2.x" | ||
}, | ||
"optionalDependencies": { | ||
"bignum": "^0.6.2" | ||
}, | ||
"homepage": "http://webtorrent.io", | ||
@@ -32,0 +34,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107217
652
- Removedbignum@^0.6.2