Skip to content

Commit

Permalink
Add subpath import for client and server (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz authored Nov 7, 2024
1 parent 8b02864 commit f2f4990
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f2f4990

Please sign in to comment.