fetch-dht/lib/peerListFormatters/compact.js

15 lines
340 B
JavaScript
Raw Permalink Normal View History

2020-04-12 21:33:32 +00:00
const bencode = require('bencode');
const string2compact = require('string2compact');
module.exports = (peers, res) => {
const response = bencode.encode({
interval: 30 * 60, // 30 minutes between requests
peers: string2compact(peers),
});
res
.set({
'Content-Length': response.length,
})
.end(response);
};