This repository has been archived by the owner on Jul 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest.js
80 lines (52 loc) · 1.62 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var Rtorrent = require('./index.js');
var config = require('./config.json');
var rtorrent = new Rtorrent({
mode: config.mode,
host: config.host,
port: config.port,
path: config.path,
user: config.user,
pass: config.pass
});
rtorrent.getAll(function (err, data) {
if (err) return console.log('err: ', err);
console.log(data);
});
/*
// manual mode
rtorrent.get('download_list', [], function (err, hashes) {
if (err) return console.log('err: ', err);
console.log(hashes);
if (hashes.length)
{
// get the name of the first torrent
rtorrent.get('d.name', [hashes[0]], function (err, data) {
if (err) return console.log('err: ', err);
console.log(data);
});
}
});
// multicall
rtorrent.getMulticall('d.multicall', ['main'], {name: 'd.name=', hash: 'd.get_hash'}, function (err, data) {
if (err) return console.log('err: ', err);
console.log(data);
});
// everything in one shot
rtorrent.getAll(function (err, data) {
if (err) return console.log('err: ', err);
console.log(data);
});
rtorrent.loadLink('magnet link or http torrent file', function (err, data) {
if (err) return console.log('err: ', err);
console.log(JSON.stringify(data, null, 4));
});
rtorrent.loadFile('local torrent file', function (err, data) {
if (err) return console.log('err: ', err);
console.log(JSON.stringify(data, null, 4));
});
// start a torrent which is already registered in rtorrent with its hash
rtorrent.start('XXXXXXXX', function (err, data) {
if (err) return console.log('err: ', err);
console.log(data);
});
*/