kaven-aria2
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Kaven-Aria2

js wrapper for aria2.

Usage

import {
    SocketExecutor, Aria2, Aria2Builder, Aria2Methods, Aria2Notifications
} from "kaven-aria2";

// comment out the following line if used in browser
import WebSocket from "ws"; // https://github.com/websockets/ws

const aria2rpc = "ws://localhost:6800/jsonrpc";
const executor = new SocketExecutor(aria2rpc, WebSocket);

const aria2 = new Aria2(executor);

// addUri
await aria2.addUri(url, { dir: "path/to/save" });

// multicall
await aria2.multicall(new Aria2Builder(Aria2Methods.getGlobalStat), ...gids.map(p => new Aria2Builder(Aria2Methods.tellStatus).SetParams(p)));

// Notifications
executor.Notification.on((data, _) => {
    if (data.method === Aria2Notifications.onDownloadStart) {
        // ...
    }
});

Package Sidebar

Install

npm i kaven-aria2

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

349 kB

Total Files

30

Last publish

Collaborators

  • kaven-npm