torrent-webserver
v1.0.4
Published
Enhanced wrapper for webtorrent client
Downloads
5
Maintainers
Readme
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"));