Coder Social home page Coder Social logo

miaomint / aria2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fengqiaozhu/aria2

0.0 0.0 0.0 103 KB

An aria2 api package developed with dart which can be used in a flutter project, support http and websocket connection to an aria2 jsonrpc server.

License: GNU General Public License v3.0

Dart 100.00%

aria2's Introduction

Aria2-Dart-Package

An aria2 api package developed with dart which can be used in a flutter project, support http and websocket connection to an aria2 jsonrpc server.

Features

  1. Connect to an aria2 jsonrpc server, control the aria2 downloader remotely.
  2. Support http, websocket.
  3. Support secret authentication

Getting started

flutter pub add aria2

Develop

// Run below shell after change the jsons/*.json model config file;
flutter packages pub run json_model

Usage

You can use this package like this:

import 'package:aria2/aria2.dart';

void main() async {
    try{
        // protocol can be "http" or "websocket"
        Aria2c aria2c = Aria2c(rpcUrl, protocol, secret);

        Aria2Version version = await aria2c.getVersion();
        print(version.toString());
        // return {"id":"flutter","jsonrpc":"2.0","result":{"enabledFeatures":["Async DNS","BitTorrent","Firefox3 Cookie","GZip","HTTPS","Message Digest","Metalink","XML-RPC","SFTP"],"version":"1.36.0"}}

        Aria2GlobalStat globalStatus = await aria2c.getGlobalStat();
        print(globalStatus.toString());
        //return {"id":"flutter","jsonrpc":"2.0","result":{"downloadSpeed":"0","numActive":"0","numStopped":"34","numStoppedTotal":"36","numWaiting":"0","uploadSpeed":"0"}}

        Aria2Option option = Aria2Option()
            ..maxOverallDownloadLimit = 1024*1024*3;
        await aria2c.changeGlobalOption(option)
    } catch (e) {
        print(e);
    }
}

More aria2 usage can be found at aria2c API

Additional information

If you have any usage problem ,please tell me in the Issues.

aria2's People

Contributors

fengqiaozhu avatar miaomint avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.