1.0.4 • Published 5 years ago

torrent-webserver v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Torrent-Webserver

Enhanced wrapper of webtorrent client.

Installation

npm i torrent-webserver

Usage

//Creating new torrent

import torrentServer from "torrent-webserver";

torrentServer
  .newTorrent(magnetURI)
  .then(torrent => {
    torrent.onMetadata = () => {
      console.log("Received Metadata", torrent.files);
    };
    torrent.onVerifying = () => {
      console.log("Verifying files...");
    };
    torrent.onReady = sessionPort => {
      console.log(`Torrent ready! Navigate to http://localhost:${sessionPort}`);
    };
  })
  .catch(err => {
    console.log(err);
  });

//Removing torrent

torrentServer
  .removeTorrent(magnetURI)
  .then(() => console.log("Torrent fully destroyed"));