mirror of
https://github.com/PurpleI2P/i2pd-tools.git
synced 2025-05-06 07:23:04 +02:00
fix up exmaples
This commit is contained in:
parent
574db0ab55
commit
028a5590ae
10 changed files with 13799 additions and 280 deletions
23
websocks-demo/bittorrent.js
Normal file
23
websocks-demo/bittorrent.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
var Protocol = require('bittorrent-protocol');
|
||||
var stream = require('stream');
|
||||
var WebSocks = require("./websocks.js").WebSocks;
|
||||
|
||||
|
||||
function start_torrent(torrent_file_blob)
|
||||
{
|
||||
var torrent = new WebsocksTorrent();
|
||||
var elem = document.getElementById("ws-server");
|
||||
torrent.start(elem.value);
|
||||
torrent.addTorrent(torrent_file_blob);
|
||||
}
|
||||
|
||||
function start_downloading()
|
||||
{
|
||||
var elem = document.getElementById("torrent-file");
|
||||
var files = elem.files;
|
||||
for (var f of files) {
|
||||
if(f.slice) {
|
||||
start_torrent(f.slice());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue