bep9-metadata-dl
Download the metadata from peers using infohash only
This module uses bittorrent-protocol, ut_metadata and torrent-discovery modules of WebTorrent to download the info-dictionary part of a .torrent file using infohash of magnet links only.
Features
- Simple API with callback and Promise interface
- Find peers from the DHT network
install
npm install infohash-to-metadata
API
fetchMetadata(infohash, [opts], [callbackFn])
fetchMetadata.fromPeer(infohash, peerAddress, [opts], [callbackFn])
Optional options are:
maxConns: 10 // Maximum connections to peers, (default=5) fetchTimeout: 30000 // A timer scheduled to keep looking for metadata (default=20000) socketTimeout: 5000 // Sets the socket to timeout after inactivity (default=5000) dht: DHT instance // Use external DHT instance (default=internael DHT instance)
Example:
const fetchMetadata = ; // infohash of ubuntu-16.04.1-server-amd64.isoconst INFO_HASH = '90289fd34dfc1cf8f316a268add8354c85334458'; ;
Or Promise based:
const fetchMetadata = ; // infohash of ubuntu-16.04.1-server-amd64.isoconst INFO_HASH = '90289fd34dfc1cf8f316a268add8354c85334458'; ;
Re-use DHT instance:
const DHT = ;const fetchMetadata = ; // infohash of ubuntu-16.04.1-server-amd64.isoconst INFO_HASH = '90289fd34dfc1cf8f316a268add8354c85334458';// infohash of ubuntu-16.04.1-desktop-amd64.isoconst INFO_HASH2 = '9f9165d9a281a9b8e782cd5176bbcc8256fd1871';// Check https://github.com/feross/bittorrent-dht for DHT optsconst dht = concurrency: 32 ; // Use designated DHT instance.; // Re-use DHT instance.;
Download directly from a peer:
const fetchMetadata = ; // infohash of ubuntu-16.04.1-server-amd64.isoconst INFO_HASH = '90289fd34dfc1cf8f316a268add8354c85334458'; fetchMetadata;
Download directly from a peer, Promise based:
const fetchMetadata = ; // infohash of ubuntu-16.04.1-server-amd64.isoconst INFO_HASH = '90289fd34dfc1cf8f316a268add8354c85334458'; fetchMetadata;