Aria2 JSON RPC client
Add this line to your application's Gemfile:
gem 'aria2'
And then execute:
$ bundle
Or install it yourself as:
$ gem install aria2
# create a client instance
client = Aria2::Client.new(host: 'localhost', port: 6800)
client.addUri 'http://example.com/images/1.jpg', 'http://example.com/images/2.jpg'
# or
client.add_uri 'http://example.com/images/1.jpg', 'http://example.com/images/2.jpg'
client.xxxx
...
# or
Aria2.with(host: 'localhost', port: 6800) do |client|
client.addUri 'http://example.com/images/1.jpg', 'http://example.com/images/2.jpg'
client.xxxx
...
end
# or
Aria2.with(host: 'localhost', port: 6800) do
addUri 'http://example.com/images/1.jpg', 'http://example.com/images/2.jpg'
xxxx
...
end
# If you invoke method end with '!', then raise Aria2::Error when json contains 'error' key
@client = Aria2::Client.new token: 'your_token'
@client.getVersion!
See Methods
- addUri(*uris)
- addTorrent(torrent) torrent is the contents of the ".torrent" file
- addMetalink(metalink)
- remove(gid)
- forceRemove(gid)
- pause(gid)
- pauseAll
- forcePause(gid)
- forcePauseAll
- unpause(gid)
- unpauseAll
- tellStatus(gid)
- getUris(gid)
- getFiles(gid)
- getPeers(gid)
- getServers(gid)
- tellActive
- tellWaiting(offset, num)
- tellStopped(offset, num)
- changePosition(gid, pos, how)
- changeUri(gid, fileIndex, delUris, addUris)
- getOption(gid)
- changeOption(gid, options)
- getGlobalOption
- changeGlobalOption(options)
- getGlobalStat
- purgeDownloadResult
- removeDownloadResult(gid)
- getVersion
- shutdown
- forceShutdown
- saveSession
Bug reports and pull requests are welcome on GitHub at https://github.com/songjiz/aria2-ruby.