26 lines
558 B
JavaScript
Raw Normal View History

/**
* Functions/constants needed by both the client and server.
*/
var Buffer = require('safe-buffer').Buffer
2014-12-13 00:09:40 +01:00
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')
2018-10-02 15:09:02 +02:00
Object.assign(exports, config)