@ctrl/shared-torrent 6.0.0 → 6.2.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/index.d.ts +48 -18
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
@@ -1,18 +1,41 @@
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
2
|
-
import type { Agent } from 'http';
|
3
1
|
export interface TorrentClient {
|
4
|
-
config:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
config: TorrentClientConfig;
|
3
|
+
state: TorrentClientState;
|
4
|
+
/**
|
5
|
+
* Create a new client instance from an existing state.
|
6
|
+
*/
|
7
|
+
createFromState(config: TorrentClientConfig, state: TorrentClientState): TorrentClient;
|
8
|
+
/**
|
9
|
+
* Export the current state of the client. Can be restored with `createFromState`.
|
10
|
+
*/
|
11
|
+
exportState(): TorrentClientState;
|
12
|
+
/**
|
13
|
+
* Returns all torrent data. Data has been normalized
|
14
|
+
*/
|
15
|
+
getAllData(): Promise<AllClientData>;
|
16
|
+
getTorrent(id: any): Promise<NormalizedTorrent>;
|
17
|
+
pauseTorrent(id: any): Promise<unknown>;
|
18
|
+
resumeTorrent(id: any): Promise<unknown>;
|
19
|
+
removeTorrent(id: any, removeData?: boolean): Promise<unknown>;
|
20
|
+
queueUp(id: any): Promise<unknown>;
|
21
|
+
queueDown(id: any): Promise<unknown>;
|
22
|
+
addTorrent(torrent: string | Uint8Array, options?: any): Promise<unknown>;
|
23
|
+
normalizedAddTorrent(torrent: string | Uint8Array, options?: Partial<AddTorrentOptions>): Promise<NormalizedTorrent>;
|
24
|
+
}
|
25
|
+
/**
|
26
|
+
* A JSON serializable object that stores the state of the client.
|
27
|
+
*/
|
28
|
+
export interface TorrentClientState {
|
29
|
+
/**
|
30
|
+
* Authentication credentials
|
31
|
+
*/
|
32
|
+
auth?: Record<string, unknown>;
|
33
|
+
/**
|
34
|
+
* Client version information
|
35
|
+
*/
|
36
|
+
version?: Record<string, unknown>;
|
14
37
|
}
|
15
|
-
export interface
|
38
|
+
export interface TorrentClientConfig {
|
16
39
|
/**
|
17
40
|
* ex - `http://localhost:4444/
|
18
41
|
*/
|
@@ -24,16 +47,23 @@ export interface TorrentSettings {
|
|
24
47
|
username?: string;
|
25
48
|
password?: string;
|
26
49
|
/**
|
27
|
-
*
|
28
|
-
*
|
50
|
+
* Pass proxy agent to ofetch
|
51
|
+
* Only supported in Node.js >= 18 using undici
|
52
|
+
*
|
53
|
+
* @see https://undici.nodejs.org/#/docs/api/Dispatcher
|
54
|
+
* @link https://github.com/unjs/ofetch#%EF%B8%8F-adding-https-agent
|
29
55
|
*/
|
30
|
-
|
56
|
+
dispatcher?: InstanceType<typeof import('undici').Dispatcher>;
|
31
57
|
/**
|
32
|
-
* request timeout
|
33
|
-
* @link https://github.com/
|
58
|
+
* global request timeout
|
59
|
+
* @link https://github.com/unjs/ofetch#%EF%B8%8F-timeout
|
34
60
|
*/
|
35
61
|
timeout?: number;
|
36
62
|
}
|
63
|
+
/**
|
64
|
+
* @deprecated Use `TorrentClientConfig` instead.
|
65
|
+
*/
|
66
|
+
export type TorrentSettings = TorrentClientConfig;
|
37
67
|
export declare enum TorrentState {
|
38
68
|
downloading = "downloading",
|
39
69
|
seeding = "seeding",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ctrl/shared-torrent",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.2.0",
|
4
4
|
"description": "shared types and interfaces between torrent clients",
|
5
5
|
"author": "Scott Cooper <scttcper@gmail.com>",
|
6
6
|
"license": "MIT",
|
@@ -16,20 +16,21 @@
|
|
16
16
|
"scripts": {
|
17
17
|
"lint": "pnpm run '/^(lint:biome|lint:eslint)$/'",
|
18
18
|
"lint:biome": "biome check .",
|
19
|
-
"lint:eslint": "eslint
|
19
|
+
"lint:eslint": "eslint .",
|
20
20
|
"lint:fix": "pnpm run '/^(lint:biome|lint:eslint):fix$/'",
|
21
|
-
"lint:eslint:fix": "eslint
|
22
|
-
"lint:biome:fix": "biome check . --
|
21
|
+
"lint:eslint:fix": "eslint . --fix",
|
22
|
+
"lint:biome:fix": "biome check . --write",
|
23
23
|
"prepare": "npm run build",
|
24
24
|
"build": "tsc"
|
25
25
|
},
|
26
26
|
"dependencies": {},
|
27
27
|
"devDependencies": {
|
28
|
-
"@biomejs/biome": "1.
|
29
|
-
"@ctrl/eslint-config-biome": "
|
30
|
-
"@sindresorhus/tsconfig": "
|
31
|
-
"@types/node": "
|
32
|
-
"typescript": "5.
|
28
|
+
"@biomejs/biome": "1.9.4",
|
29
|
+
"@ctrl/eslint-config-biome": "4.3.1",
|
30
|
+
"@sindresorhus/tsconfig": "7.0.0",
|
31
|
+
"@types/node": "22.10.2",
|
32
|
+
"typescript": "5.7.2",
|
33
|
+
"undici": "^7.2.0"
|
33
34
|
},
|
34
35
|
"publishConfig": {
|
35
36
|
"access": "public",
|