bittorrent-tracker/lib/common.js
Feross Aboukhadijeh d6751dac41 remove safe-buffer
2019-08-06 17:58:05 -07:00

24 lines
514 B
JavaScript

/**
* Functions/constants needed by both the client and server.
*/
exports.DEFAULT_ANNOUNCE_PEERS = 50
exports.MAX_ANNOUNCE_PEERS = 82
exports.binaryToHex = function (str) {
if (typeof str !== 'string') {
str = String(str)
}
return Buffer.from(str, 'binary').toString('hex')
}
exports.hexToBinary = function (str) {
if (typeof str !== 'string') {
str = String(str)
}
return Buffer.from(str, 'hex').toString('binary')
}
var config = require('./common-node')
Object.assign(exports, config)