maria2
Modern & Simple RPC Library for aria2.
Introduce
maria2
can control aria2c
by its RPC interface.
Features
- Simple.
- Better TypeScript IDE Support.
- Browser and Node.js Support.
Example
pnpm i maria2
- If you are using Node.js, you have to install peer dependencies.
pnpm i uuid
pnpm i ws
pnpm i cross-fetch
- Start aria2 with rpc, example
aria2c --enable-rpc=true --rpc-listen-all=true --rpc-allow-origin-all=true --rpc-listen-port=6800
import { open, aria2 } from 'maria2'
const conn = await open(
new WebSocket('ws://localhost:6800/jsonrpc')
)
const version = await aria2.getVersion(conn)
import { open, createHTTP, aria2 } from 'maria2'
const conn = await open(
createHTTP('http://localhost:6800/jsonrpc')
)
const version = await aria2.getVersion(conn)
import { open, system } from 'maria2'
const conn = await open(
new WebSocket('ws://localhost:6800/jsonrpc')
)
const [result0, result1] = await system.multicall({
methodName: 'aria2.getVersion',
params: []
}, {
methodName: 'aria2.getGlobalStat',
params: []
})
Thanks to
License
MIT License © 2023 Hydration