bncode -> bencode

This commit is contained in:
Feross Aboukhadijeh 2014-06-11 17:57:19 -07:00
parent 4704774265
commit 6696c01ee2
3 changed files with 7 additions and 7 deletions

View File

@ -1,7 +1,7 @@
module.exports = Client
var BN = require('bn.js')
var bncode = require('bncode')
var bencode = require('bencode')
var common = require('./lib/common')
var compact2string = require('compact2string')
var concat = require('concat-stream')
@ -412,7 +412,7 @@ Tracker.prototype._handleResponse = function (requestUrl, data) {
var self = this
try {
data = bncode.decode(data)
data = bencode.decode(data)
} catch (err) {
return self.client.emit('error', new Error('Error decoding tracker response: ' + err.message))
}

View File

@ -14,8 +14,8 @@
"url": "https://github.com/feross/bittorrent-tracker/issues"
},
"dependencies": {
"bencode": "^0.6.0",
"bn.js": "^0.11.7",
"bncode": "^0.5.3",
"buffer-equal": "0.0.1",
"compact2string": "^1.2.0",
"concat-stream": "^1.4.5",

View File

@ -1,6 +1,6 @@
module.exports = Server
var bncode = require('bncode')
var bencode = require('bencode')
var bufferEqual = require('buffer-equal')
var common = require('./lib/common')
var dgram = require('dgram')
@ -216,7 +216,7 @@ Server.prototype._onHttpRequest = function (req, res) {
if (warning) {
response['warning message'] = warning
}
res.end(bncode.encode(response))
res.end(bencode.encode(response))
} else if (s[0] === '/scrape') { // unofficial scrape message
var swarm = self._getSwarm(infoHash)
@ -231,11 +231,11 @@ Server.prototype._onHttpRequest = function (req, res) {
}
}
res.end(bncode.encode(response))
res.end(bencode.encode(response))
}
function error (message) {
res.end(bncode.encode({
res.end(bencode.encode({
'failure reason': message
}))