BTFS 2.3 adds a new command/API to downloads the files of a specific bittorrent seed or a magnet URI scheme based on BTIP-1
BTFS integrated with the Bittorrent libs to serve as a Bittorrent client, and communicate with the tracker, DHT, webseed or Bittorrent peers, and then downloads the content, after downloading completed, stop the communications with those p2p.
btfs bittorrent download -t torrent-file.torrent
btfs bittorrent download 'magnet:?xt=urn:btih:KRWPCX3SJUM4IMM4YF5RPHL6ANPYTQPU'
btfs bittorrent metainfo -t xxx.torrent
btfs bittorrent metainfo -m 'magnet:?xt=urn:btih:KRWPCX3SJUM4IMM4YF5RPHL6ANPYTQPU'
# -t tracker url, -i pieces of info-hashes which separated by commas btfs bittorrent scrape -t '' -i ''
btfs bittorrent bencode -f xxx.torrent
# -f files which you want to share with the bittorrent network,separated by commas btfs bittorrent serve -f 'xxx.mp4,xxx.jpeg'
This command will start a daemon to serve as a client and output the magnet url every file you tap in.
BTFS is dirrent from BitTorrent but they have something same such as they are all distributed network and decentralized.When we integrate with bittorrent, we consider the following steps:
- Parsing the magnetic links to bittorrent metadata if the target is a magnet url.
- Parsing the bittorrent file to bittorrent metadata if the target is a bittorrent seed file.
- Judge by the bittorrent metadata and choose how to get peers by tracker/dht/webseed/peer.
- Split the bittorrent metadata into a list of pieces and download all this pieces independently from the peers.
- We can see the process of downloading in the console.
- When downloading is finished, add this file to the local BTFS node by
btfs add file
- Maybe we can add a more user-interactive friendly dashboard to view this process.
Updated 9 months ago