1 import * as WebTorrent from 'webtorrent'
3 let webtorrent: WebTorrent.Instance
5 function webtorrentAdd (torrent: string, refreshWebTorrent = false) {
6 const WebTorrent = require('webtorrent')
8 if (!webtorrent) webtorrent = new WebTorrent()
9 if (refreshWebTorrent === true) webtorrent = new WebTorrent()
11 return new Promise<WebTorrent.Torrent>(res => webtorrent.add(torrent, res))