@z-torrent/node
v0.0.15
Published
Streaming torrent client for Node.js (Z-Torrent)
Downloads
1,154
Maintainers
Readme
@z-torrent/node
Node.js entry for Z-Torrent: streaming BitTorrent client built on @z-torrent/core with TCP/µTP, DHT, trackers, LSD, and optional WebRTC (via @thaunknown/simple-peer).
Install
npm install @z-torrent/nodeUsage
Use the named export ZTorrent (there is no default export).
import { ZTorrent } from '@z-torrent/node'
const client = new ZTorrent({
dht: true,
tracker: true,
lsd: true,
})
client.on('error', (err) => {
console.error(err)
})
const torrent = client.add('magnet:?xt=urn:btih:…')
torrent.on('ready', () => {
console.log('Torrent metadata ready', torrent.name)
})
// …
client.destroy(() => {
console.log('Client destroyed')
})Static fields on the class:
ZTorrent.VERSION— package version stringZTorrent.WEBRTC_SUPPORT— whether WebRTC data channels are availableZTorrent.UTP_SUPPORT— whether µTP listener support is available (nativeutp-native)
Scripts (package development)
bun run build # tsdown → dist/
bun run typecheck # tsc --noEmit (src only)
bun test # fast suite (skips flaky localhost tracker/DHT integration)
bun run test-live # sets Z_TORRENT_LIVE=1; needs working local UDP/TCP socketsLicense
MIT
