amule-ec-client 0.1.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 +141 -0
- package/dist/index.d.ts +902 -0
- package/dist/index.js +2567 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# aMule EC Client for TypeScript
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/amule-ec-client)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A TypeScript client library for interacting with aMule's External Connection (EC) protocol.
|
|
7
|
+
|
|
8
|
+
Ported from [jamule](https://github.com/vexdev/jamule) (Java/Kotlin) to TypeScript.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- ✅ Full EC protocol implementation (v0x0204)
|
|
13
|
+
- ✅ Authentication and connection management
|
|
14
|
+
- ✅ Server statistics
|
|
15
|
+
- ✅ File searching (local, global, Kad, web)
|
|
16
|
+
- ✅ Download management
|
|
17
|
+
- ✅ Shared files listing
|
|
18
|
+
- ⏳ Category management (partial)
|
|
19
|
+
- ⏳ ED2K link parsing
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install amule-ec-client
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { AmuleClient, SearchType } from 'amule-ec-client';
|
|
31
|
+
|
|
32
|
+
// Create client
|
|
33
|
+
const client = new AmuleClient({
|
|
34
|
+
host: 'localhost',
|
|
35
|
+
port: 4712,
|
|
36
|
+
password: 'your-password',
|
|
37
|
+
timeout: 10000, // optional, in milliseconds
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Get server stats
|
|
41
|
+
const stats = await client.getStats();
|
|
42
|
+
console.log(`Download speed: ${stats.downloadSpeed} bytes/s`);
|
|
43
|
+
console.log(`Upload speed: ${stats.uploadSpeed} bytes/s`);
|
|
44
|
+
|
|
45
|
+
// Perform a search
|
|
46
|
+
const results = await client.searchSync('ubuntu', SearchType.GLOBAL);
|
|
47
|
+
console.log(`Found ${results.files.length} files`);
|
|
48
|
+
|
|
49
|
+
for (const file of results.files) {
|
|
50
|
+
console.log(`${file.fileName} (${file.sizeFull} bytes)`);
|
|
51
|
+
|
|
52
|
+
// Download a file
|
|
53
|
+
if (file.sourceCount > 5) {
|
|
54
|
+
await client.downloadSearchResult(file.hash);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Get download queue
|
|
59
|
+
const queue = await client.getDownloadQueue();
|
|
60
|
+
console.log(`${queue.length} files downloading`);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
### AmuleClient
|
|
66
|
+
|
|
67
|
+
#### Constructor
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
new AmuleClient(options: AmuleClientOptions)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Options:
|
|
74
|
+
|
|
75
|
+
- `host`: aMule server hostname
|
|
76
|
+
- `port`: EC port (default: 4712)
|
|
77
|
+
- `password`: EC password
|
|
78
|
+
- `timeout`: Connection timeout in ms (optional)
|
|
79
|
+
|
|
80
|
+
#### Methods
|
|
81
|
+
|
|
82
|
+
**Connection**
|
|
83
|
+
|
|
84
|
+
- `reconnect(): Promise<void>` - Reconnect to server
|
|
85
|
+
|
|
86
|
+
**Statistics**
|
|
87
|
+
|
|
88
|
+
- `getStats(): Promise<StatsResponse>` - Get server statistics
|
|
89
|
+
|
|
90
|
+
**Search**
|
|
91
|
+
|
|
92
|
+
- `searchAsync(query, searchType?, filters?): Promise<string>` - Start async search
|
|
93
|
+
- `searchStatus(): Promise<number>` - Get search progress (0-1)
|
|
94
|
+
- `searchResults(): Promise<SearchResultsResponse>` - Get search results
|
|
95
|
+
- `searchSync(query, searchType?, filters?, timeout?): Promise<SearchResultsResponse>` - Synchronous search
|
|
96
|
+
- `searchStop(): Promise<void>` - Stop current search
|
|
97
|
+
|
|
98
|
+
**Downloads**
|
|
99
|
+
|
|
100
|
+
- `downloadSearchResult(hash, category?): Promise<void>` - Download from search results
|
|
101
|
+
- `getDownloadQueue(): Promise<AmuleTransferringFile[]>` - Get download queue
|
|
102
|
+
|
|
103
|
+
**Shared Files**
|
|
104
|
+
|
|
105
|
+
- `getSharedFiles(): Promise<AmuleFile[]>` - Get shared files
|
|
106
|
+
|
|
107
|
+
## Protocol Details
|
|
108
|
+
|
|
109
|
+
This library implements the aMule External Connection protocol version 0x0204, compatible with:
|
|
110
|
+
|
|
111
|
+
- aMule 2.3.1
|
|
112
|
+
- aMule 2.3.2
|
|
113
|
+
- aMule 2.3.3
|
|
114
|
+
|
|
115
|
+
### Protocol Features
|
|
116
|
+
|
|
117
|
+
- UTF-8 number encoding for reduced packet size
|
|
118
|
+
- ZLIB compression support
|
|
119
|
+
- MD5-based authentication with salt
|
|
120
|
+
- Binary packet format with tagged data structures
|
|
121
|
+
|
|
122
|
+
## Development
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Install dependencies
|
|
126
|
+
npm install
|
|
127
|
+
|
|
128
|
+
# Build
|
|
129
|
+
npm run build
|
|
130
|
+
|
|
131
|
+
# Test
|
|
132
|
+
npm test
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Credits
|
|
136
|
+
|
|
137
|
+
- Original Java/Kotlin implementation: [jamule](https://github.com/vexdev/jamule) by [vexdev](https://github.com/vexdev)
|
|
138
|
+
|
|
139
|
+
## License
|
|
140
|
+
|
|
141
|
+
MIT License
|