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

1.0.11 • Public • Published

Aria2-Api

base on axios

Usage

    //token 如果配置了的话
let instance = axios.create({baseURL: "/aria2", timeout: 10000})
let token = "token"
let aria2 = new Aria2(instance, token);
// let aria2 = new Aria2(this.instance);

//原生用法
aria2.call(Aria2Method.GET_GLOBAL_STAT, []).then(res => {
    console.log(res)
})
//预定义方法
aria2.getGlobalStat().then(res => {
    console.log(res)
})
//添加下载
let url = "https://i.pximg.net/img-original/img/2022/06/19/04/30/30/99147997_p0.jpg"
aria2.addUri([url], {dir: "D:\\pixiv", out: undefined, referer: "*", cookie: undefined}).then(res => {
    console.log(res)
})
//批量任务
aria2.multiCall([
    {methodName: Aria2Method.ADD_URI, params: [[url], {dir: "D:/pixiv/1"}]},
    {methodName: Aria2Method.ADD_URI, params: [[url], {dir: "D:/pixiv/2"}]},
    {methodName: Aria2Method.ADD_URI, params: [[url], {dir: "D:/pixiv/3"}]},
])

Readme

Keywords

Package Sidebar

Install

npm i aria2-api

Weekly Downloads

2

Version

1.0.11

License

ISC

Unpacked Size

13.4 kB

Total Files

22

Last publish

Collaborators

  • ginstone