// the find
mafintosh/torrent-stream
The low level streaming torrent engine that peerflix uses
A node.js streaming engine for BitTorrent that lets you treat torrent files as readable streams without downloading everything first. It's the guts behind peerflix — if you want to pipe a torrent into ffmpeg or a media server, this is where you'd start.
Lazy piece selection is genuinely useful: only the pieces needed by active streams get prioritized, so you can start streaming before the full download completes. The pluggable storage backend is a good design decision — swap in memory or custom backends without touching the core. API surface is small and honest about what it does. Byte-range slicing via createReadStream opts maps cleanly onto HTTP Range requests, which is exactly what you need for video streaming.
Dead since 2020 — no commits in six years, dependencies are ancient (peer-wire-swarm, bitfield, etc.), and none of them have been updated for modern Node. The webtorrent ecosystem has largely superseded this and its dependencies are actively maintained. No TypeScript types and the callback/event-emitter API predates Promises, so integrating it into async/await code is friction. Test coverage is thin — the test suite covers basic cases but there's nothing for edge conditions like piece corruption recovery or tracker failure fallback. Connection limits are hardcoded defaults with no backpressure signaling exposed to the consumer.