torrent-webserver

1.0.4 • Public • Published

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"));

Package Sidebar

Install

npm i torrent-webserver

Weekly Downloads

3

Version

1.0.4

License

MIT

Unpacked Size

7.14 kB

Total Files

4

Last publish

Collaborators

  • le.lence