Skip to main content

Aria2 - awesome command line download manager

Back in my Windows days aka the dark ages, I was very into download managers.  This was probably because those days we had slow Internet like dial-up and cable with speeds up to 128 kbps down / 64 kbps up. So at this kind of speeds it makes more sense to use download managers, mostly  because you are waiting all the time and these managers made you feel that things moved faster even if sometimes that was not the case. Also, IE was very dominant browser at the time and when it crashed  you would have to re-download instead of just continue, that was the biggest reason why I was using FlashGet, Go!Zilla and of course Download Accelerator Plus.
I am still under the impression that most of these programs were "placebo" like, just making you feel that things are moving faster.


Nowadays download speed is rarely the issue, but sometimes we like to automate downloads. Great way to automate is using terminal based download manager. Aria2 has some very interesting features that we can use. Basically aria2 is a lightweight multi-protocol and  multi-source command line download manager. It has support for HTTP/HTTPS, FTP, BitTorrent, and Metalink

There are many other alternatives that come to mind like wget or cURL but with aria2 you can download files from several URIs using different protocols and also if you give aria2 list of files it will download them concurrently.
aria2 download very well: aria2 cancels slow servers and use the faster server to finish the download. In other words, it is very clever and reliable in many different situations and it does most of the downloads in parallel.

Installation

You can download it directly from SourceForge. 
I'm using the Linux version, but there are releases of Windows and Android, but I can't say that I have tried them. There are also packages for most of the Linux distributions.

For Debian based (Ubuntu, Linux Mint):

sudo apt-get install aria2 

Arch Linux

sudo pacman -S aria2 
Fedora and yum based
sudo yum install aria2

Few simple examples 
  • Download a file

 aria2c  location-or-URL-of-file

  • Download from multiple sources

 aria2c  location1 location2 location3 ... 

  • Download torrent

 aria2c location-of-file.torrent 

  • List files in a torrent

aria2c -S location-of-file.torrent 

  • Download specific files from torrent

aria2c --select-file=1,2,3... location-of-file.torrent

index of files ( 1,2,3 ) can be  found with -S command
  • Limit speed for upload ( on torrent files, for example )

aria2c --max-upload-limit=200K location-of-file.torrent 

 
  • Limit speed for download

aria2c --max-download-limit=100K location of file

 
  • Pause and resume
In order to pause just press Ctrl+C and to resume enter the same command at the same location. Aria2 keeps .aria2 files where it memorizes the current download progress.
  • Download using multiple connections

aria2c -j7 -x2 location-of-file  other-location-of-file...


this way we instruct aria2c to use 7 concurrent connections with max 2 connections per server
  • Download  a list of files from URI provided in a file

aria2c -i file-with-uris.txt 
 

Links

http://sourceforge.net/projects/aria2/files/stable/


Popular posts from this blog

HTML 5 data-* attributes, how to use them and why

It is always tempting to add custom attributes in HTML so that you can use the data stored there to do X. But if you do that there is no way of knowing if your HTML attribute will not be overridden in the future and used for something else and additionally you will not be writing valid HTML markup that can pass HTML 5 validator and with that you can create some very bad side effects. That is why there is a spec in HTML 5 called custom data attributes that enable number of useful features.

You may go around and read the specs, but the basic idea is very simple, you can add any attribute that starts with "data-" and that attribute will be treated as non-visible data for that attribute. By non-visible I mean that it is not something that gets rendered to the client so it does not affect the layout or style of the page, but it is there in the HTML so in no way this is private.
So let's get right into it, the following snippet is a valid HTML5 markup

<div id="aweso…

Basic Authentication with RestTemplate

Spring Rest Templates are very good way of writing REST clients. By default they work with basic HTTP so if we need to use Basic Authorization we would need to init the rest template with custom HttpClient. This way the Rest Template will automatically use Basic Auth and append to the HTTP headers "Authorization: Basic BASE64ENCODED_USER_PASS".

HttpClient client = new HttpClient(); UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("USERNAME","PASS"); client.getState().setCredentials( new AuthScope("www.example.com", 9090, AuthScope.ANY_REALM), credentials); CommonsClientHttpRequestFactory commons = new CommonsClientHttpRequestFactory(client); RestTemplate template = new RestTemplate(commons); SomeObject result = template.getForObject( "http://www.example.com:9090/",SomeObject.class );

In EE application this would probably be managed by DI framework like Spring Core and only initialized once sin…

How to Not Hate JavaScript: Tips from the Frontline

This article was originally published on voxxed under, https://www.voxxed.com/blog/2014/11/how-to-not-hate-java-script-tips-from-the-frontline/


In my work assisting teams with JavaScript related problems, I’ve noticed some common issues. If you're experiencing frustrations with the language too, this article might be of some assistance. Disclaimer: a few of my tips might be obvious to some of you, but hopefully you’ll find at least some useful nuggets of information here! These pointers are especially useful when dealing with enterprise applications and CMS solutions. This is where we have our code, the CMS code, the code from that team nobody wants to mention...and, of course, all of them are loaded asynchronously.
The Debugger Statement
This is one of the most underused features when dealing with JavaScript, especially since it’s supported by the majority of browsers. The debugger statement was part of the first edition of ECMA Script so it's been here for quite some time.

F…