A TypeScript client for Amule EC API.
npm install amule-ec-client

A TypeScript client library for interacting with aMule's External Connection (EC) protocol.
Ported from jamule (Java/Kotlin) to TypeScript.
- ✅ Full EC protocol implementation (v0x0204)
- ✅ Authentication and connection management
- ✅ Server statistics
- ✅ File searching (local, global, Kad, web)
- ✅ Download management
- ✅ Shared files listing
- ⏳ Category management (partial)
- ⏳ ED2K link parsing
``bash`
npm install amule-ec-client
`typescript
import { AmuleClient, SearchType } from 'amule-ec-client';
// Create client
const client = new AmuleClient({
host: 'localhost',
port: 4712,
password: 'your-password',
timeout: 10000, // optional, in milliseconds
});
// Get server stats
const stats = await client.getStats();
console.log(Download speed: ${stats.downloadSpeed} bytes/s);Upload speed: ${stats.uploadSpeed} bytes/s
console.log();
// Perform a search
const results = await client.searchSync('ubuntu', SearchType.GLOBAL);
console.log(Found ${results.files.length} files);
for (const file of results.files) {
console.log(${file.fileName} (${file.sizeFull} bytes));
// Download a file
if (file.sourceCount > 5) {
await client.downloadSearchResult(file.hash);
}
}
// Get download queue
const queue = await client.getDownloadQueue();
console.log(${queue.length} files downloading);`
#### Constructor
`typescript`
new AmuleClient(options: AmuleClientOptions)
Options:
- host: aMule server hostnameport
- : EC port (default: 4712)password
- : EC passwordtimeout
- : Connection timeout in ms (optional)
#### Methods
Connection
- reconnect(): Promise - Reconnect to server
Statistics
- getStats(): Promise - Get server statistics
Search
- searchAsync(query, searchType?, filters?): Promise - Start async searchsearchStatus(): Promise
- - Get search progress (0-1)searchResults(): Promise
- - Get search resultssearchSync(query, searchType?, filters?, timeout?): Promise
- - Synchronous searchsearchStop(): Promise
- - Stop current search
Downloads
- downloadSearchResult(hash, category?): Promise - Download from search resultsgetDownloadQueue(): Promise
- - Get download queue
Shared Files
- getSharedFiles(): Promise - Get shared files
This library implements the aMule External Connection protocol version 0x0204, compatible with:
- aMule 2.3.1
- aMule 2.3.2
- aMule 2.3.3
- UTF-8 number encoding for reduced packet size
- ZLIB compression support
- MD5-based authentication with salt
- Binary packet format with tagged data structures
`bashInstall dependencies
npm install
- Original Java/Kotlin implementation: jamule by vexdev
MIT License