@ctrl/qbittorrent 9.5.2 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/qbittorrent.d.ts +8 -0
- package/dist/src/qbittorrent.js +30 -2
- package/dist/src/types.d.ts +9 -1
- package/package.json +10 -10
@@ -178,10 +178,18 @@ export declare class QBittorrent implements TorrentClient {
|
|
178
178
|
/**
|
179
179
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#pause-torrents}
|
180
180
|
*/
|
181
|
+
stopTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
|
182
|
+
/**
|
183
|
+
* @deprecated Alias for {@link stopTorrent}.
|
184
|
+
*/
|
181
185
|
pauseTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
|
182
186
|
/**
|
183
187
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#resume-torrents}
|
184
188
|
*/
|
189
|
+
startTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
|
190
|
+
/**
|
191
|
+
* @deprecated Alias for {@link startTorrent}.
|
192
|
+
*/
|
185
193
|
resumeTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
|
186
194
|
/**
|
187
195
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-torrents}
|
package/dist/src/qbittorrent.js
CHANGED
@@ -145,6 +145,22 @@ export class QBittorrent {
|
|
145
145
|
params.hashes = normalizeHashes(hashes);
|
146
146
|
}
|
147
147
|
if (filter) {
|
148
|
+
if (this.state.version?.isVersion5OrHigher) {
|
149
|
+
if (filter === 'paused') {
|
150
|
+
filter = 'stopped';
|
151
|
+
}
|
152
|
+
else if (filter === 'resumed') {
|
153
|
+
filter = 'running';
|
154
|
+
}
|
155
|
+
}
|
156
|
+
else if (filter === 'stopped') {
|
157
|
+
// For versions < 5
|
158
|
+
filter = 'paused';
|
159
|
+
}
|
160
|
+
else if (filter === 'running') {
|
161
|
+
// For versions < 5
|
162
|
+
filter = 'resumed';
|
163
|
+
}
|
148
164
|
params.filter = filter;
|
149
165
|
}
|
150
166
|
if (category !== undefined) {
|
@@ -365,16 +381,22 @@ export class QBittorrent {
|
|
365
381
|
/**
|
366
382
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#pause-torrents}
|
367
383
|
*/
|
368
|
-
async
|
384
|
+
async stopTorrent(hashes) {
|
369
385
|
const endpoint = this.state.version?.isVersion5OrHigher ? '/torrents/stop' : '/torrents/pause';
|
370
386
|
const data = { hashes: normalizeHashes(hashes) };
|
371
387
|
await this.request(endpoint, 'POST', undefined, objToUrlSearchParams(data));
|
372
388
|
return true;
|
373
389
|
}
|
390
|
+
/**
|
391
|
+
* @deprecated Alias for {@link stopTorrent}.
|
392
|
+
*/
|
393
|
+
async pauseTorrent(hashes) {
|
394
|
+
return this.stopTorrent(hashes);
|
395
|
+
}
|
374
396
|
/**
|
375
397
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#resume-torrents}
|
376
398
|
*/
|
377
|
-
async
|
399
|
+
async startTorrent(hashes) {
|
378
400
|
const endpoint = this.state.version?.isVersion5OrHigher
|
379
401
|
? '/torrents/start'
|
380
402
|
: '/torrents/resume';
|
@@ -382,6 +404,12 @@ export class QBittorrent {
|
|
382
404
|
await this.request(endpoint, 'POST', undefined, objToUrlSearchParams(data));
|
383
405
|
return true;
|
384
406
|
}
|
407
|
+
/**
|
408
|
+
* @deprecated Alias for {@link startTorrent}.
|
409
|
+
*/
|
410
|
+
async resumeTorrent(hashes) {
|
411
|
+
return this.startTorrent(hashes);
|
412
|
+
}
|
385
413
|
/**
|
386
414
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#delete-torrents}
|
387
415
|
* @param deleteFiles (default: false) remove files from disk
|
package/dist/src/types.d.ts
CHANGED
@@ -20,7 +20,15 @@ export interface BuildInfo {
|
|
20
20
|
*/
|
21
21
|
bitness: string;
|
22
22
|
}
|
23
|
-
|
23
|
+
/**
|
24
|
+
* @deprecated Replaced by 'running' in qBittorrent v5.
|
25
|
+
*/
|
26
|
+
type TorrentFilterResumed = 'resumed';
|
27
|
+
/**
|
28
|
+
* @deprecated Replaced by 'stopped' in qBittorrent v5.
|
29
|
+
*/
|
30
|
+
type TorrentFilterPaused = 'paused';
|
31
|
+
export type TorrentFilters = 'all' | 'downloading' | 'seeding' | 'completed' | TorrentFilterPaused | 'stopped' | 'active' | 'inactive' | TorrentFilterResumed | 'running' | 'stalled' | 'stalled_uploading' | 'stalled_downloading' | 'checking' | 'moving' | 'errored';
|
24
32
|
export interface Torrent {
|
25
33
|
/**
|
26
34
|
* Torrent name
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ctrl/qbittorrent",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.6.0",
|
4
4
|
"description": "TypeScript api wrapper for qbittorrent using got",
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
6
6
|
"license": "MIT",
|
@@ -42,22 +42,21 @@
|
|
42
42
|
"cookie": "^1.0.2",
|
43
43
|
"node-fetch-native": "^1.6.6",
|
44
44
|
"ofetch": "^1.4.1",
|
45
|
-
"type-fest": "^4.
|
46
|
-
"ufo": "^1.
|
45
|
+
"type-fest": "^4.40.0",
|
46
|
+
"ufo": "^1.6.1",
|
47
47
|
"uint8array-extras": "^1.4.0"
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
50
|
"@biomejs/biome": "1.9.4",
|
51
|
-
"@ctrl/eslint-config-biome": "4.3.
|
51
|
+
"@ctrl/eslint-config-biome": "4.3.5",
|
52
52
|
"@eslint/compat": "^1.2.8",
|
53
53
|
"@sindresorhus/tsconfig": "7.0.0",
|
54
|
-
"@types/
|
55
|
-
"@types/node": "22.14.0",
|
54
|
+
"@types/node": "22.14.1",
|
56
55
|
"@vitest/coverage-v8": "3.1.1",
|
57
|
-
"eslint": "^9.
|
56
|
+
"eslint": "^9.25.0",
|
58
57
|
"p-wait-for": "5.0.2",
|
59
|
-
"typedoc": "0.28.
|
60
|
-
"typescript": "5.8.
|
58
|
+
"typedoc": "0.28.3",
|
59
|
+
"typescript": "5.8.3",
|
61
60
|
"vitest": "3.1.1"
|
62
61
|
},
|
63
62
|
"release": {
|
@@ -67,5 +66,6 @@
|
|
67
66
|
},
|
68
67
|
"engines": {
|
69
68
|
"node": ">=18"
|
70
|
-
}
|
69
|
+
},
|
70
|
+
"packageManager": "pnpm@10.8.1"
|
71
71
|
}
|