From f2f4990501f918bf6ab0106a03f9c7a1d0d1bbc8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Nov 2024 19:00:51 +0100 Subject: [PATCH] Add subpath import for client and server (#535) --- README.md | 3 +++ package.json | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f0d99c1..db0eba16 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 982272d3..8984180a 100644 --- a/package.json +++ b/package.json @@ -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",