@ctrl/qbittorrent 7.1.2 → 8.0.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.
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
2
1
|
import type { AddTorrentOptions as NormalizedAddTorrentOptions, AllClientData, NormalizedTorrent, TorrentClient, TorrentSettings } from '@ctrl/shared-torrent';
|
3
2
|
import type { AddMagnetOptions, AddTorrentOptions, BuildInfo, Preferences, Torrent, TorrentCategories, TorrentFile, TorrentFilePriority, TorrentFilters, TorrentPeersResponse, TorrentPieceState, TorrentProperties, TorrentTrackers, WebSeed } from './types.js';
|
4
3
|
export declare class QBittorrent implements TorrentClient {
|
@@ -151,8 +150,8 @@ export declare class QBittorrent implements TorrentClient {
|
|
151
150
|
* {@link https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#reannounce-torrents}
|
152
151
|
*/
|
153
152
|
reannounceTorrent(hashes: string | string[] | 'all'): Promise<boolean>;
|
154
|
-
addTorrent(torrent: string |
|
155
|
-
normalizedAddTorrent(torrent: string |
|
153
|
+
addTorrent(torrent: string | Uint8Array, options?: Partial<AddTorrentOptions>): Promise<boolean>;
|
154
|
+
normalizedAddTorrent(torrent: string | Uint8Array, options?: Partial<NormalizedAddTorrentOptions>): Promise<NormalizedTorrent>;
|
156
155
|
/**
|
157
156
|
* @param hash Hash for desired torrent
|
158
157
|
* @param id id of the file to be renamed
|
package/dist/src/qbittorrent.js
CHANGED
@@ -2,6 +2,7 @@ import { parse as cookieParse } from 'cookie';
|
|
2
2
|
import { FormData } from 'node-fetch-native';
|
3
3
|
import { ofetch } from 'ofetch';
|
4
4
|
import { joinURL } from 'ufo';
|
5
|
+
import { base64ToUint8Array, isUint8Array, stringToUint8Array } from 'uint8array-extras';
|
5
6
|
import { magnetDecode } from '@ctrl/magnet-link';
|
6
7
|
import { hash } from '@ctrl/torrent-file';
|
7
8
|
import { normalizeTorrentData } from './normalizeTorrentData.js';
|
@@ -346,7 +347,7 @@ export class QBittorrent {
|
|
346
347
|
}
|
347
348
|
const type = { type: 'application/x-bittorrent' };
|
348
349
|
if (typeof torrent === 'string') {
|
349
|
-
form.set('file', new File([
|
350
|
+
form.set('file', new File([base64ToUint8Array(torrent)], 'file.torrent', type));
|
350
351
|
}
|
351
352
|
else {
|
352
353
|
const file = new File([torrent], options.filename ?? 'torrent', type);
|
@@ -387,8 +388,8 @@ export class QBittorrent {
|
|
387
388
|
await this.addMagnet(torrent, torrentOptions);
|
388
389
|
}
|
389
390
|
else {
|
390
|
-
if (!
|
391
|
-
torrent =
|
391
|
+
if (!isUint8Array(torrent)) {
|
392
|
+
torrent = stringToUint8Array(torrent);
|
392
393
|
}
|
393
394
|
torrentHash = await hash(torrent);
|
394
395
|
await this.addTorrent(torrent, torrentOptions);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ctrl/qbittorrent",
|
3
|
-
"version": "
|
3
|
+
"version": "8.0.0",
|
4
4
|
"description": "TypeScript api wrapper for qbittorrent using got",
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
6
6
|
"license": "MIT",
|
@@ -22,8 +22,12 @@
|
|
22
22
|
"qbittorrent"
|
23
23
|
],
|
24
24
|
"scripts": {
|
25
|
-
"lint": "
|
26
|
-
"lint:
|
25
|
+
"lint": "pnpm run '/^(lint:biome|lint:eslint)$/'",
|
26
|
+
"lint:biome": "biome check .",
|
27
|
+
"lint:eslint": "eslint --ext .ts,.tsx .",
|
28
|
+
"lint:fix": "pnpm run '/^(lint:biome|lint:eslint):fix$/'",
|
29
|
+
"lint:eslint:fix": "eslint --ext .ts,.tsx . --fix",
|
30
|
+
"lint:biome:fix": "biome check . --apply",
|
27
31
|
"prepare": "npm run build",
|
28
32
|
"build": "tsc",
|
29
33
|
"build:docs": "typedoc",
|
@@ -33,23 +37,25 @@
|
|
33
37
|
},
|
34
38
|
"dependencies": {
|
35
39
|
"@ctrl/magnet-link": "^4.0.1",
|
36
|
-
"@ctrl/shared-torrent": "^
|
37
|
-
"@ctrl/torrent-file": "^
|
40
|
+
"@ctrl/shared-torrent": "^6.0.0",
|
41
|
+
"@ctrl/torrent-file": "^4.0.0",
|
38
42
|
"cookie": "^0.6.0",
|
39
|
-
"node-fetch-native": "^1.6.
|
43
|
+
"node-fetch-native": "^1.6.2",
|
40
44
|
"ofetch": "^1.3.3",
|
41
|
-
"ufo": "^1.
|
45
|
+
"ufo": "^1.4.0",
|
46
|
+
"uint8array-extras": "^1.1.0"
|
42
47
|
},
|
43
48
|
"devDependencies": {
|
44
|
-
"@
|
49
|
+
"@biomejs/biome": "1.6.0",
|
50
|
+
"@ctrl/eslint-config-biome": "2.1.1",
|
45
51
|
"@sindresorhus/tsconfig": "5.0.0",
|
46
52
|
"@types/cookie": "0.6.0",
|
47
|
-
"@types/node": "20.
|
48
|
-
"@vitest/coverage-v8": "1.1
|
53
|
+
"@types/node": "20.11.25",
|
54
|
+
"@vitest/coverage-v8": "1.3.1",
|
49
55
|
"p-wait-for": "5.0.2",
|
50
|
-
"typedoc": "0.25.
|
51
|
-
"typescript": "5.
|
52
|
-
"vitest": "1.1
|
56
|
+
"typedoc": "0.25.12",
|
57
|
+
"typescript": "5.4.2",
|
58
|
+
"vitest": "1.3.1"
|
53
59
|
},
|
54
60
|
"release": {
|
55
61
|
"branches": [
|