Add subpath import for client and server (#535)
Some checks failed
ci / Node ${{ matrix.node }} / ${{ matrix.os }} (18, ubuntu-latest) (push) Has been cancelled
Release / Release (push) Has been cancelled

This commit is contained in:
Chocobozzz 2024-11-07 19:00:51 +01:00 committed by GitHub
parent 8b02864b51
commit f2f4990501
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -160,6 +160,7 @@ To start a BitTorrent tracker server to track swarms of peers:
```js
import { Server } from 'bittorrent-tracker'
// Or import Server from 'bittorrent-tracker/server'
const server = new Server({
udp: true, // enable udp server? [default=true]
@ -267,6 +268,8 @@ Scraping multiple torrent info is possible with a static `Client.scrape` method:
```js
import Client from 'bittorrent-tracker'
// Or import Client from 'bittorrent-tracker/client'
Client.scrape({ announce: announceUrl, infoHash: [ infoHash1, infoHash2 ]}, function (err, results) {
results[infoHash1].announce
results[infoHash1].infoHash

View File

@ -64,7 +64,15 @@
"node": ">=16.0.0"
},
"exports": {
"import": "./index.js"
".": {
"import": "./index.js"
},
"./client": {
"import": "./client.js"
},
"./server": {
"import": "./server.js"
}
},
"keywords": [
"bittorrent",