aria2-api
v1.0.11
Published
aria2-api
Downloads
8
Readme
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"}]},
])