node.jsp2pbittorrentwebtorrent

NodeJS: Download torrent as stream


TL;DR Is is possible to proxy torrent larger than available local disk while piping it to outbound stream ?

According to BitTorrent spec , all torrents are stored as pieces of equal length , I want to write a node app could pipe the torrent pieces to a http upload stream , does any library provide such functionality ? All the implementation I have found downloads the whole file to local storage then propagate it further which can cause problems when running on small disk and large files .


Solution

  • Bittorrent is designed for random access to keep data available via the rarest-first strategy. See Section 2.4.2 of the bittorrent econ paper. While it is possible to operate it in a streaming manner anyway this generally isn't recommended and certainly shouldn't be the default, otherwise performance could severely degrade for all swarm members or content could even become unavailable.