@ctrl/qbittorrent 9.5.2 → 9.7.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/README.md +2 -2
- package/dist/src/qbittorrent.d.ts +10 -2
- package/dist/src/qbittorrent.js +30 -2
- package/dist/src/types.d.ts +9 -1
- package/package.json +39 -23
package/README.md
CHANGED
@@ -28,7 +28,7 @@ async function main() {
|
|
28
28
|
### API
|
29
29
|
|
30
30
|
Docs: https://qbittorrent.vercel.app
|
31
|
-
qBittorrent Api Docs: https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)
|
31
|
+
qBittorrent Api Docs: https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)
|
32
32
|
|
33
33
|
### Normalized API
|
34
34
|
|
@@ -103,7 +103,7 @@ console.log(result);
|
|
103
103
|
If you're shutting down the server often (serverless?) you can export the state
|
104
104
|
|
105
105
|
```ts
|
106
|
-
const state = client.exportState()
|
106
|
+
const state = client.exportState();
|
107
107
|
const client = QBittorrent.createFromState(config, state);
|
108
108
|
```
|
109
109
|
|
@@ -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}
|
@@ -196,8 +204,8 @@ export declare class QBittorrent implements TorrentClient {
|
|
196
204
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#reannounce-torrents}
|
197
205
|
*/
|
198
206
|
reannounceTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
|
199
|
-
addTorrent(torrent: string | Uint8Array
|
200
|
-
normalizedAddTorrent(torrent: string | Uint8Array
|
207
|
+
addTorrent(torrent: string | Uint8Array<ArrayBuffer>, options?: Partial<AddTorrentOptions>): Promise<boolean>;
|
208
|
+
normalizedAddTorrent(torrent: string | Uint8Array<ArrayBuffer>, options?: Partial<NormalizedAddTorrentOptions>): Promise<NormalizedTorrent>;
|
201
209
|
/**
|
202
210
|
* @param hash Hash for desired torrent
|
203
211
|
* @param oldPath id of the file to be renamed
|
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.7.0",
|
4
4
|
"description": "TypeScript api wrapper for qbittorrent using got",
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
6
6
|
"license": "MIT",
|
@@ -22,12 +22,8 @@
|
|
22
22
|
"qbittorrent"
|
23
23
|
],
|
24
24
|
"scripts": {
|
25
|
-
"lint": "
|
26
|
-
"lint:
|
27
|
-
"lint:eslint": "eslint .",
|
28
|
-
"lint:fix": "pnpm run '/^(lint:biome|lint:eslint):fix$/'",
|
29
|
-
"lint:eslint:fix": "eslint . --fix",
|
30
|
-
"lint:biome:fix": "biome check . --write",
|
25
|
+
"lint": "oxlint . && prettier --check . --experimental-cli",
|
26
|
+
"lint:fix": "oxlint . --fix && prettier --write . --log-level=error --experimental-cli",
|
31
27
|
"prepare": "npm run build",
|
32
28
|
"build": "tsc",
|
33
29
|
"build:docs": "typedoc",
|
@@ -37,28 +33,27 @@
|
|
37
33
|
},
|
38
34
|
"dependencies": {
|
39
35
|
"@ctrl/magnet-link": "^4.0.2",
|
40
|
-
"@ctrl/shared-torrent": "^6.
|
36
|
+
"@ctrl/shared-torrent": "^6.3.0",
|
41
37
|
"@ctrl/torrent-file": "^4.1.0",
|
42
38
|
"cookie": "^1.0.2",
|
43
|
-
"node-fetch-native": "^1.6.
|
39
|
+
"node-fetch-native": "^1.6.7",
|
44
40
|
"ofetch": "^1.4.1",
|
45
|
-
"type-fest": "^4.
|
46
|
-
"ufo": "^1.
|
47
|
-
"uint8array-extras": "^1.
|
41
|
+
"type-fest": "^4.41.0",
|
42
|
+
"ufo": "^1.6.1",
|
43
|
+
"uint8array-extras": "^1.5.0"
|
48
44
|
},
|
49
45
|
"devDependencies": {
|
50
|
-
"@
|
51
|
-
"@
|
52
|
-
"@
|
53
|
-
"@
|
54
|
-
"@
|
55
|
-
"
|
56
|
-
"@vitest/coverage-v8": "3.1.1",
|
57
|
-
"eslint": "^9.23.0",
|
46
|
+
"@ctrl/oxlint-config": "1.2.3",
|
47
|
+
"@sindresorhus/tsconfig": "8.0.1",
|
48
|
+
"@trivago/prettier-plugin-sort-imports": "5.2.2",
|
49
|
+
"@types/node": "24.3.0",
|
50
|
+
"@vitest/coverage-v8": "3.2.4",
|
51
|
+
"oxlint": "1.14.0",
|
58
52
|
"p-wait-for": "5.0.2",
|
59
|
-
"
|
60
|
-
"
|
61
|
-
"
|
53
|
+
"prettier": "3.6.2",
|
54
|
+
"typedoc": "0.28.11",
|
55
|
+
"typescript": "5.9.2",
|
56
|
+
"vitest": "3.2.4"
|
62
57
|
},
|
63
58
|
"release": {
|
64
59
|
"branches": [
|
@@ -67,5 +62,26 @@
|
|
67
62
|
},
|
68
63
|
"engines": {
|
69
64
|
"node": ">=18"
|
65
|
+
},
|
66
|
+
"packageManager": "pnpm@10.15.0",
|
67
|
+
"prettier": {
|
68
|
+
"singleQuote": true,
|
69
|
+
"trailingComma": "all",
|
70
|
+
"arrowParens": "avoid",
|
71
|
+
"semi": true,
|
72
|
+
"printWidth": 100,
|
73
|
+
"plugins": [
|
74
|
+
"@trivago/prettier-plugin-sort-imports"
|
75
|
+
],
|
76
|
+
"importOrder": [
|
77
|
+
"^node:.*$",
|
78
|
+
"<THIRD_PARTY_MODULES>",
|
79
|
+
"^(@ctrl)(/.*|$)",
|
80
|
+
"^\\.\\./(?!.*\\.css$)",
|
81
|
+
"^\\./(?!.*\\.css$)(?=.*/)",
|
82
|
+
"^\\./(?!.*\\.css$)(?!.*/)"
|
83
|
+
],
|
84
|
+
"importOrderSeparation": true,
|
85
|
+
"importOrderSortSpecifiers": false
|
70
86
|
}
|
71
87
|
}
|